You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by su...@apache.org on 2020/08/17 07:00:50 UTC
[ofbiz-framework] branch trunk updated: Improved: Added missing
Javadocs for some methods,
this is required for all classes which looks like designed for extension
(can be subclassed). (OFBIZ-11947) This is done for framework component.
Also corrected some variables as per naming convention best practices.
Thanks Jacques for review.
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 8c10d4a Improved: Added missing Javadocs for some methods, this is required for all classes which looks like designed for extension (can be subclassed). (OFBIZ-11947) This is done for framework component. Also corrected some variables as per naming convention best practices. Thanks Jacques for review.
8c10d4a is described below
commit 8c10d4ae724dd06fc0e2003ad49a5b90ad86eea2
Author: Suraj Khurana <su...@apache.org>
AuthorDate: Mon Aug 17 12:30:26 2020 +0530
Improved: Added missing Javadocs for some methods, this is required for all classes which looks like designed for extension (can be subclassed).
(OFBIZ-11947)
This is done for framework component. Also corrected some variables as per naming convention best practices.
Thanks Jacques for review.
---
.../ofbiz/base/component/ComponentConfig.java | 252 ++++++---
.../base/component/ComponentLoaderConfig.java | 6 -
.../ofbiz/base/concurrent/ExecutionPool.java | 33 +-
.../apache/ofbiz/base/config/JNDIConfigUtil.java | 40 +-
.../ofbiz/base/container/ComponentContainer.java | 6 -
.../org/apache/ofbiz/base/container/Container.java | 4 -
.../ofbiz/base/container/ContainerConfig.java | 6 -
.../ofbiz/base/container/ContainerLoader.java | 3 -
.../apache/ofbiz/base/conversion/Converter.java | 5 -
.../ofbiz/base/conversion/ConverterCreator.java | 1 -
.../ofbiz/base/conversion/ConverterLoader.java | 1 -
.../apache/ofbiz/base/conversion/Converters.java | 38 +-
.../ofbiz/base/conversion/LocalizedConverter.java | 4 -
.../ofbiz/base/conversion/MiscConverters.java | 4 +-
.../ofbiz/base/html/CustomPermissivePolicy.java | 1 -
.../ofbiz/base/html/SanitizerCustomPolicy.java | 1 -
.../java/org/apache/ofbiz/base/lang/Factory.java | 1 -
.../main/java/org/apache/ofbiz/base/lang/JSON.java | 13 +-
.../java/org/apache/ofbiz/base/lang/Range.java | 10 -
.../ofbiz/base/location/FlexibleLocation.java | 9 +-
.../base/location/OFBizHomeLocationResolver.java | 6 +-
.../apache/ofbiz/base/metrics/MetricsFactory.java | 1 -
.../java/org/apache/ofbiz/base/util/Assert.java | 11 -
.../java/org/apache/ofbiz/base/util/DateRange.java | 2 +-
.../java/org/apache/ofbiz/base/util/Debug.java | 106 ++--
.../java/org/apache/ofbiz/base/util/Digraph.java | 3 -
.../java/org/apache/ofbiz/base/util/FileUtil.java | 9 -
.../org/apache/ofbiz/base/util/GroovyUtil.java | 3 -
.../ofbiz/base/util/HttpRequestFileUpload.java | 6 +-
.../apache/ofbiz/base/util/JNDIContextFactory.java | 29 +-
.../org/apache/ofbiz/base/util/ObjectType.java | 82 +--
.../org/apache/ofbiz/base/util/Observable.java | 5 -
.../java/org/apache/ofbiz/base/util/Observer.java | 1 -
.../org/apache/ofbiz/base/util/PatternFactory.java | 7 +-
.../ofbiz/base/util/RMIExtendedSocketFactory.java | 2 -
.../ofbiz/base/util/SafeObjectInputStream.java | 1 -
.../org/apache/ofbiz/base/util/ScriptHelper.java | 11 -
.../org/apache/ofbiz/base/util/ScriptUtil.java | 9 -
.../java/org/apache/ofbiz/base/util/Scriptlet.java | 1 -
.../org/apache/ofbiz/base/util/StringUtil.java | 11 +-
.../org/apache/ofbiz/base/util/TimeDuration.java | 29 +-
.../java/org/apache/ofbiz/base/util/UtilCodec.java | 31 +-
.../org/apache/ofbiz/base/util/UtilDateTime.java | 63 +--
.../org/apache/ofbiz/base/util/UtilFormatOut.java | 3 -
.../java/org/apache/ofbiz/base/util/UtilHttp.java | 29 --
.../java/org/apache/ofbiz/base/util/UtilIO.java | 14 -
.../java/org/apache/ofbiz/base/util/UtilMisc.java | 18 -
.../org/apache/ofbiz/base/util/UtilNumber.java | 5 -
.../org/apache/ofbiz/base/util/UtilObject.java | 1 -
.../java/org/apache/ofbiz/base/util/UtilPlist.java | 2 -
.../org/apache/ofbiz/base/util/UtilProperties.java | 6 -
.../java/org/apache/ofbiz/base/util/UtilTimer.java | 1 -
.../java/org/apache/ofbiz/base/util/UtilURL.java | 2 -
.../org/apache/ofbiz/base/util/UtilValidate.java | 205 ++++----
.../java/org/apache/ofbiz/base/util/UtilXml.java | 6 -
.../apache/ofbiz/base/util/cache/CacheLine.java | 8 +-
.../base/util/collections/FlexibleMapAccessor.java | 20 +-
.../ofbiz/base/util/collections/LifoSet.java | 6 -
.../util/collections/MultivaluedMapContext.java | 3 -
.../base/util/string/FlexibleStringExpander.java | 140 +++--
.../ofbiz/base/util/string/UelFunctions.java | 1 -
.../ofbiz/base/util/template/FreeMarkerWorker.java | 4 -
.../apache/ofbiz/base/util/TimeDurationTests.java | 10 +-
.../base/util/collections/MapContextTest.java | 5 -
.../catalina/container/CatalinaContainer.java | 55 +-
.../org/apache/ofbiz/common/CommonWorkers.java | 2 -
.../java/org/apache/ofbiz/common/FindServices.java | 10 -
.../authentication/AuthenticationComparator.java | 1 -
.../authentication/api/AuthenticatorException.java | 6 -
.../example/TestFailAuthenticator.java | 9 -
.../example/TestPassAuthenticator.java | 2 -
.../ofbiz/common/email/NotificationServices.java | 3 -
.../apache/ofbiz/common/image/ImageTransform.java | 4 -
.../apache/ofbiz/common/login/LoginServices.java | 2 -
.../ofbiz/common/preferences/PreferenceWorker.java | 2 -
.../java/org/apache/ofbiz/datafile/DataFile.java | 1 -
.../apache/ofbiz/datafile/DataFile2EntityXml.java | 29 +-
.../org/apache/ofbiz/datafile/ModelDataFile.java | 144 +++++-
.../apache/ofbiz/datafile/ModelDataFileReader.java | 107 ++--
.../java/org/apache/ofbiz/datafile/ModelField.java | 184 ++++++-
.../org/apache/ofbiz/datafile/ModelRecord.java | 233 ++++++++-
.../java/org/apache/ofbiz/datafile/Record.java | 235 ++++++---
.../org/apache/ofbiz/datafile/RecordIterator.java | 129 +++--
.../java/org/apache/ofbiz/entity/Delegator.java | 57 ---
.../org/apache/ofbiz/entity/GenericEntity.java | 7 -
.../java/org/apache/ofbiz/entity/GenericValue.java | 9 -
.../ofbiz/entity/condition/EntityCondition.java | 23 -
.../entity/condition/EntityConditionList.java | 3 -
.../entity/condition/EntityConditionListBase.java | 3 -
.../entity/condition/EntityConditionUtils.java | 2 -
.../entity/condition/EntityConditionVisitor.java | 6 -
.../condition/EntityDateFilterCondition.java | 6 -
.../apache/ofbiz/entity/condition/EntityExpr.java | 6 -
.../ofbiz/entity/condition/EntityFieldMap.java | 7 -
.../ofbiz/entity/condition/EntityFunction.java | 33 +-
.../ofbiz/entity/condition/EntityNotCondition.java | 1 -
.../ofbiz/entity/condition/EntityOperator.java | 75 ++-
.../ofbiz/entity/condition/EntityWhereString.java | 2 -
.../ofbiz/entity/config/model/EntityConfig.java | 2 -
.../apache/ofbiz/entity/datasource/GenericDAO.java | 1 -
.../org/apache/ofbiz/entity/jdbc/DatabaseUtil.java | 496 ++++++++++++++----
.../org/apache/ofbiz/entity/jdbc/SQLProcessor.java | 57 +--
.../org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java | 3 -
.../ofbiz/entity/model/DynamicViewEntity.java | 8 -
.../org/apache/ofbiz/entity/model/ModelEntity.java | 4 -
.../org/apache/ofbiz/entity/model/ModelField.java | 34 +-
.../ofbiz/entity/model/ModelGroupReader.java | 18 +-
.../org/apache/ofbiz/entity/model/ModelReader.java | 44 +-
.../org/apache/ofbiz/entity/model/ModelUtil.java | 2 -
.../ofbiz/entity/serialize/XmlSerializer.java | 3 -
.../apache/ofbiz/entity/test/EntityTestSuite.java | 1 -
.../ofbiz/entity/util/EntityBatchIterator.java | 14 +-
.../apache/ofbiz/entity/util/EntityDataLoader.java | 29 +-
.../ofbiz/entity/util/EntityListIterator.java | 16 -
.../apache/ofbiz/entity/util/EntityTypeUtil.java | 1 -
.../org/apache/ofbiz/entity/util/EntityUtil.java | 13 -
.../org/apache/ofbiz/entity/util/SequenceUtil.java | 50 +-
.../ofbiz/entityext/EntityWatchServices.java | 1 -
.../entityext/data/EntityDataLoadContainer.java | 1 -
.../apache/ofbiz/entityext/eca/EntityEcaUtil.java | 21 +-
.../synchronization/EntitySyncContext.java | 562 ++++++++++++++------
.../synchronization/EntitySyncServices.java | 105 ++--
.../org/apache/ofbiz/minilang/SimpleMethod.java | 2 -
.../minilang/method/callops/FlexibleMessage.java | 4 +-
.../ofbiz/minilang/method/conditional/Compare.java | 1 -
.../java/org/apache/ofbiz/security/CsrfUtil.java | 6 +-
.../java/org/apache/ofbiz/security/Security.java | 10 -
.../org/apache/ofbiz/security/SecurityFactory.java | 2 -
.../org/apache/ofbiz/security/SecurityUtil.java | 4 -
.../org/apache/ofbiz/service/DispatchContext.java | 2 -
.../apache/ofbiz/service/ServiceDispatcher.java | 3 -
.../java/org/apache/ofbiz/service/ServiceUtil.java | 2 -
.../calendar/TemporalExpressionPrinter.java | 35 +-
.../service/calendar/TemporalExpressionWorker.java | 42 +-
.../service/calendar/TemporalExpressions.java | 68 ++-
.../ofbiz/service/config/ServiceConfigUtil.java | 1 -
.../ofbiz/service/engine/AbstractEngine.java | 2 -
.../ofbiz/service/engine/EntityAutoEngine.java | 4 -
.../apache/ofbiz/service/engine/GenericEngine.java | 4 -
.../org/apache/ofbiz/service/job/JobManager.java | 9 -
.../org/apache/ofbiz/service/job/JobPoller.java | 49 +-
.../apache/ofbiz/service/rmi/RemoteDispatcher.java | 2 -
.../ofbiz/service/semaphore/ServiceSemaphore.java | 2 -
.../service/test/ServiceEngineTestServices.java | 1 -
.../org/apache/ofbiz/base/start/AdminClient.java | 2 -
.../java/org/apache/ofbiz/base/start/Start.java | 2 -
.../ofbiz/base/start/StartupCommandUtil.java | 2 -
.../ofbiz/base/start/StartupControlPanel.java | 4 -
.../java/org/apache/ofbiz/webapp/WebAppCache.java | 22 +-
.../java/org/apache/ofbiz/webapp/WebAppUtil.java | 20 +-
.../ofbiz/webapp/control/ConfigXMLReader.java | 4 -
.../apache/ofbiz/webapp/control/ControlFilter.java | 4 -
.../ofbiz/webapp/control/ControlServlet.java | 1 -
.../webapp/control/ExternalLoginKeysManager.java | 3 -
.../apache/ofbiz/webapp/control/JWTManager.java | 11 -
.../apache/ofbiz/webapp/control/LoginWorker.java | 8 -
.../ofbiz/webapp/control/ProtectViewWorker.java | 37 +-
.../ofbiz/webapp/control/RequestHandler.java | 11 -
.../org/apache/ofbiz/webapp/event/CoreEvents.java | 3 -
.../apache/ofbiz/webapp/event/EventHandler.java | 2 -
.../ofbiz/webapp/event/RequestBodyMapHandler.java | 1 -
.../ofbiz/webapp/ftl/OfbizContentTransform.java | 2 +-
.../apache/ofbiz/webapp/stats/ServerHitBin.java | 96 ++--
.../apache/ofbiz/webapp/view/ApacheFopWorker.java | 75 +--
.../org/apache/ofbiz/webapp/view/ViewHandler.java | 2 -
.../apache/ofbiz/webapp/webdav/RequestHandler.java | 1 -
.../ofbiz/webapp/webdav/RequestHandlerFactory.java | 1 -
.../org/apache/ofbiz/webapp/webdav/WebDavUtil.java | 1 -
.../apache/ofbiz/webapp/website/WebSiteWorker.java | 1 -
.../org/apache/ofbiz/webtools/GenericWebEvent.java | 1 -
.../apache/ofbiz/webtools/WebToolsServices.java | 1 -
.../webtools/artifactinfo/ServiceArtifactInfo.java | 1 -
.../artifactinfo/ServiceEcaArtifactInfo.java | 1 -
.../java/org/apache/ofbiz/widget/WidgetWorker.java | 2 -
.../ofbiz/widget/model/AbstractModelAction.java | 14 -
.../ofbiz/widget/model/AbstractModelCondition.java | 16 -
.../ofbiz/widget/model/CommonWidgetModels.java | 1 -
.../org/apache/ofbiz/widget/model/FieldInfo.java | 1 -
.../org/apache/ofbiz/widget/model/ModelAction.java | 1 -
.../ofbiz/widget/model/ModelConditionFactory.java | 1 -
.../org/apache/ofbiz/widget/model/ModelForm.java | 5 -
.../apache/ofbiz/widget/model/ModelFormAction.java | 2 -
.../apache/ofbiz/widget/model/ModelFormField.java | 568 +++++++++++++++++++--
.../org/apache/ofbiz/widget/model/ModelGrid.java | 3 -
.../org/apache/ofbiz/widget/model/ModelMenu.java | 6 -
.../apache/ofbiz/widget/model/ModelMenuAction.java | 1 -
.../ofbiz/widget/model/ModelMenuCondition.java | 3 -
.../apache/ofbiz/widget/model/ModelMenuItem.java | 3 -
.../org/apache/ofbiz/widget/model/ModelScreen.java | 1 -
.../ofbiz/widget/model/ModelScreenCondition.java | 3 -
.../apache/ofbiz/widget/model/ModelSingleForm.java | 3 -
.../org/apache/ofbiz/widget/model/ModelTree.java | 9 -
.../apache/ofbiz/widget/model/ModelTreeAction.java | 7 -
.../org/apache/ofbiz/widget/model/ModelWidget.java | 1 -
.../ofbiz/widget/model/ModelWidgetCondition.java | 17 -
.../widget/model/XmlAbstractWidgetVisitor.java | 65 ++-
.../ofbiz/widget/model/XmlWidgetActionVisitor.java | 1 +
.../widget/model/XmlWidgetConditionVisitor.java | 2 +
.../ofbiz/widget/model/XmlWidgetFieldVisitor.java | 1 +
.../ofbiz/widget/model/XmlWidgetVisitor.java | 1 +
.../apache/ofbiz/widget/renderer/FormRenderer.java | 3 -
.../ofbiz/widget/renderer/FormStringRenderer.java | 21 +-
.../ofbiz/widget/renderer/MenuWrapTransform.java | 18 +-
.../ofbiz/widget/renderer/ScreenRenderer.java | 3 -
.../widget/renderer/ScreenStringRenderer.java | 30 +-
.../apache/ofbiz/widget/renderer/UtilHelpText.java | 1 -
.../widget/renderer/fo/ScreenFopViewHandler.java | 59 ++-
.../widget/renderer/macro/MacroFormRenderer.java | 98 ++--
.../ofbiz/widget/model/ModelFormFieldTest.java | 1 -
209 files changed, 3567 insertions(+), 2220 deletions(-)
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 f197695..dd2c1f9 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
@@ -59,16 +59,15 @@ public final class ComponentConfig {
private static final String MODULE = ComponentConfig.class.getName();
public static final String OFBIZ_COMPONENT_XML_FILENAME = "ofbiz-component.xml";
// This map is not a UtilCache instance because there is no strategy or implementation for reloading components.
- private static final ComponentConfigCache componentConfigCache = new ComponentConfigCache();
+ private static final ComponentConfigCache COMPONENT_CONFIG_CACHE = new ComponentConfigCache();
public static Boolean componentExists(String componentName) {
Assert.notEmpty("componentName", componentName);
- return componentConfigCache.fromGlobalName(componentName) != null;
+ return COMPONENT_CONFIG_CACHE.fromGlobalName(componentName) != null;
}
/**
* Constructs a component predicate checking if it corresponds to a specific name.
- *
* @param cname the name of the component to match which can be {@code null}
* which means "any" component
* @return a component predicate for matching a specific component name.
@@ -79,7 +78,6 @@ public final class ComponentConfig {
/**
* Provides the list of all the classpath information available in components.
- *
* @return a list of classpath information
*/
public static List<ClasspathInfo> getAllClasspathInfos() {
@@ -89,26 +87,24 @@ public final class ComponentConfig {
}
public static Collection<ComponentConfig> getAllComponents() {
- return componentConfigCache.values();
+ return COMPONENT_CONFIG_CACHE.values();
}
/**
* Sorts the cached component configurations.
- *
* @throws ComponentException when a component configuration contains an invalid dependency
* or if the dependency graph contains a cycle.
*/
public static void sortDependencies() throws ComponentException {
- componentConfigCache.sort();
+ COMPONENT_CONFIG_CACHE.sort();
}
public static Stream<ComponentConfig> components() {
- return componentConfigCache.values().stream();
+ return COMPONENT_CONFIG_CACHE.values().stream();
}
/**
* Provides the list of all the container configuration elements available in components.
- *
* @return a list of container configuration elements
*/
public static List<ContainerConfig.Configuration> getAllConfigurations() {
@@ -123,7 +119,6 @@ public final class ComponentConfig {
/**
* Provides the list of all the entity resource information matching a type.
- *
* @param type the service resource type to match
* @param name the name of the component to match
* @return a list of entity resource information
@@ -138,7 +133,6 @@ public final class ComponentConfig {
/**
* Provides the list of all the keystore information available in components.
- *
* @return a list of keystore information
*/
public static List<KeystoreInfo> getAllKeystoreInfos() {
@@ -149,7 +143,6 @@ public final class ComponentConfig {
/**
* Provides the list of all the service resource information matching a type.
- *
* @param type the service resource type to match
* @return a list of service resource information
*/
@@ -162,7 +155,6 @@ public final class ComponentConfig {
/**
* Provides the list of all the test-suite information matching a component name.
- *
* @param name the name of the component to match where {@code null} means "any"
* @return a list of test-suite information
*/
@@ -175,7 +167,6 @@ public final class ComponentConfig {
/**
* Provides the list of all the web-app information in components
- *
* @return a list of web-app information
*/
public static List<WebappInfo> getAllWebappResourceInfos() {
@@ -192,13 +183,13 @@ public final class ComponentConfig {
public static ComponentConfig getComponentConfig(String globalName, String rootLocation) throws ComponentException {
ComponentConfig componentConfig;
if (globalName != null && !globalName.isEmpty()) {
- componentConfig = componentConfigCache.fromGlobalName(globalName);
+ componentConfig = COMPONENT_CONFIG_CACHE.fromGlobalName(globalName);
if (componentConfig != null) {
return componentConfig;
}
}
if (rootLocation != null && !rootLocation.isEmpty()) {
- componentConfig = componentConfigCache.fromRootLocation(rootLocation);
+ componentConfig = COMPONENT_CONFIG_CACHE.fromRootLocation(rootLocation);
if (componentConfig != null) {
return componentConfig;
}
@@ -209,7 +200,7 @@ public final class ComponentConfig {
}
componentConfig = new ComponentConfig(globalName, rootLocation);
if (componentConfig.enabled()) {
- componentConfigCache.put(componentConfig);
+ COMPONENT_CONFIG_CACHE.put(componentConfig);
}
return componentConfig;
}
@@ -221,7 +212,6 @@ public final class ComponentConfig {
/**
* Provides the first key-store matching a name from a specific component.
- *
* @param componentName the name of the component to match which can be {@code null}
* @param keystoreName the name of the key-store to match which can be {@code null}
* @return the first key-store matching both {@code componentName} and {@code keystoreName}.
@@ -283,10 +273,8 @@ public final class ComponentConfig {
/**
* Instantiates a component configuration from a {@link ComponentConfig.Builder builder} object.
- *
* This allows instantiating component configuration without an XML entity object,
* which is useful for example when writing unit tests.
- *
* @param b the component configuration builder
*/
private ComponentConfig(Builder b) {
@@ -390,13 +378,12 @@ public final class ComponentConfig {
}
public ComponentConfig create() {
- return new ComponentConfig(this);
+ return new ComponentConfig(this);
}
}
/**
* Instantiates a component config from a component name and a root location.
- *
* @param globalName the global name of the component which can be {@code null}
* @param rootLocation the root location of the component
* @throws ComponentException when component directory does not exist or if the
@@ -447,7 +434,6 @@ public final class ComponentConfig {
/**
* Constructs an immutable list of objects from the the childs of an XML element.
- *
* @param ofbizComponentElement the XML element containing the childs
* @param elemName the name of the child elements to collect
* @param mapper the constructor use to map child elements to objects
@@ -473,7 +459,6 @@ public final class ComponentConfig {
/**
* Provides the list of class path information.
- *
* @return an immutable list containing the class path information.
*/
public List<ClasspathInfo> getClasspathInfos() {
@@ -507,7 +492,8 @@ public final class ComponentConfig {
if (UtilValidate.isNotEmpty(resourceLoaderInfo.prependEnv)) {
String propValue = System.getProperty(resourceLoaderInfo.prependEnv);
if (propValue == null) {
- String errMsg = "The Java environment (-Dxxx=yyy) variable with name " + resourceLoaderInfo.prependEnv + " is not set, cannot load resource.";
+ String errMsg = "The Java environment (-Dxxx=yyy) variable with name "
+ + resourceLoaderInfo.prependEnv + " is not set, cannot load resource.";
Debug.logError(errMsg, MODULE);
throw new IllegalArgumentException(errMsg);
}
@@ -526,7 +512,6 @@ public final class ComponentConfig {
/**
* Provides the list of dependent components.
- *
* @return an immutable list containing the dependency information.
*/
public List<String> getDependsOn() {
@@ -543,7 +528,6 @@ public final class ComponentConfig {
/**
* Provides the root location of the component definition.
- *
* @return a normalized absolute path
*/
public Path rootLocation() {
@@ -621,9 +605,7 @@ public final class ComponentConfig {
/**
* An object that models the <code><classpath></code> element.
- *
* @see <code>ofbiz-component.xsd</code>
- *
*/
public static final class ClasspathInfo {
private final ComponentConfig componentConfig;
@@ -716,9 +698,7 @@ public final class ComponentConfig {
/**
* Provides a sequence of cached component configurations.
- *
* <p>the order of the sequence is arbitrary unless the {@link #sort())} has been invoked beforehand.
- *
* @return the list of cached component configurations
*/
synchronized List<ComponentConfig> values() {
@@ -731,9 +711,7 @@ public final class ComponentConfig {
/**
* Provides the stored dependencies as component configurations.
- *
* <p>Handle invalid dependencies by creating dummy component configurations.
- *
* @param the component configuration containing dependencies
* @return a collection of component configurations dependencies.
*/
@@ -766,13 +744,15 @@ public final class ComponentConfig {
/**
* An object that models the <code><entity-resource></code> element.
- *
* @see <code>ofbiz-component.xsd</code>
- *
*/
public static final class EntityResourceInfo extends ResourceInfo {
- public final String type;
- public final String readerName;
+ private final String type;
+ private final String readerName;
+
+ public String getReaderName() {
+ return readerName;
+ }
private EntityResourceInfo(ComponentConfig componentConfig, Element element) {
super(componentConfig, element);
@@ -783,9 +763,7 @@ public final class ComponentConfig {
/**
* An object that models the <code><keystore></code> element.
- *
* @see <code>ofbiz-component.xsd</code>
- *
*/
public static final class KeystoreInfo extends ResourceInfo {
private final String name;
@@ -845,14 +823,29 @@ public final class ComponentConfig {
this.location = element.getAttribute("location");
}
+ /**
+ * Create resource handler component resource handler.
+ *
+ * @return the component resource handler
+ */
public ComponentResourceHandler createResourceHandler() {
return new ComponentResourceHandler(componentConfig.getGlobalName(), loader, location);
}
+ /**
+ * Gets component config.
+ *
+ * @return the component config
+ */
public ComponentConfig getComponentConfig() {
return componentConfig;
}
+ /**
+ * Gets location.
+ *
+ * @return the location
+ */
public String getLocation() {
return location;
}
@@ -860,15 +853,13 @@ public final class ComponentConfig {
/**
* An object that models the <code><resource-loader></code> element.
- *
* @see <code>ofbiz-component.xsd</code>
- *
*/
public static final class ResourceLoaderInfo {
- public final String name;
- public final String type;
- public final String prependEnv;
- public final String prefix;
+ private final String name;
+ private final String type;
+ private final String prependEnv;
+ private final String prefix;
private ResourceLoaderInfo(Element element) {
this.name = element.getAttribute("name");
@@ -880,12 +871,10 @@ public final class ComponentConfig {
/**
* An object that models the <code><service-resource></code> element.
- *
* @see <code>ofbiz-component.xsd</code>
- *
*/
public static final class ServiceResourceInfo extends ResourceInfo {
- public final String type;
+ private final String type;
private ServiceResourceInfo(ComponentConfig componentConfig, Element element) {
super(componentConfig, element);
@@ -895,9 +884,7 @@ public final class ComponentConfig {
/**
* An object that models the <code><test-suite></code> element.
- *
* @see <code>ofbiz-component.xsd</code>
- *
*/
public static final class TestSuiteInfo extends ResourceInfo {
public TestSuiteInfo(ComponentConfig componentConfig, Element element) {
@@ -907,38 +894,56 @@ public final class ComponentConfig {
/**
* An object that models the <code><webapp></code> element.
- *
* @see <code>ofbiz-component.xsd</code>
- *
*/
public static final class WebappInfo {
- // FIXME: These fields should be private - since we have accessors - but
- // client code accesses the fields directly.
- public final ComponentConfig componentConfig;
- public final List<String> virtualHosts;
- public final Map<String, String> initParameters;
- public final String name;
- public final String title;
- public final String description;
- public final String menuName;
- public final String server;
- public final String mountPoint;
- public final String contextRoot;
- public final String location;
- public final String[] basePermission;
- public final String position;
- public final boolean privileged;
+ private final ComponentConfig componentConfig;
+ private final List<String> virtualHosts;
+ private final Map<String, String> initParameters;
+ private final String name;
+ private final String title;
+ private final String description;
+ private final String menuName;
+ private final String server;
+ private final String mountPoint;
+ private final String contextRoot;
+ private final String location;
+ private final String[] basePermission;
+ private final String position;
+ private final boolean privileged;
// CatalinaContainer modifies this field.
private volatile boolean appBarDisplay;
private final String accessPermission;
private final boolean useAutologinCookie;
+ public String getLocation() {
+ return location;
+ }
+
+ public String getMenuName() {
+ return menuName;
+ }
+
+ public String getPosition() {
+ return position;
+ }
+
+ public ComponentConfig getComponentConfig() {
+ return componentConfig;
+ }
+
+ public String getServer() {
+ return server;
+ }
+
+ public boolean isPrivileged() {
+ return privileged;
+ }
+
/**
* Instantiates a webapp information from a {@link WebappInfo.Builder builder} object.
- *
* This allows instantiating webapp information without an XML entity object,
* which is useful for example when writing unit tests.
- *
* @param b the webapp information builder
*/
private WebappInfo(Builder b) {
@@ -983,91 +988,198 @@ public final class ComponentConfig {
private String accessPermission;
private boolean useAutologinCookie;
+ /**
+ * Component config builder.
+ *
+ * @param componentConfig the component config
+ * @return the builder
+ */
public Builder componentConfig(ComponentConfig componentConfig) {
this.componentConfig = componentConfig;
return this;
}
+ /**
+ * Virtual hosts builder.
+ *
+ * @param virtualHosts the virtual hosts
+ * @return the builder
+ */
public Builder virtualHosts(List<String> virtualHosts) {
this.virtualHosts = virtualHosts;
return this;
}
+ /**
+ * Init parameters builder.
+ *
+ * @param initParameters the init parameters
+ * @return the builder
+ */
public Builder initParameters(Map<String, String> initParameters) {
this.initParameters = initParameters;
return this;
}
+ /**
+ * Name builder.
+ *
+ * @param name the name
+ * @return the builder
+ */
public Builder name(String name) {
this.name = name;
return this;
}
+ /**
+ * Title builder.
+ *
+ * @param title the title
+ * @return the builder
+ */
public Builder title(String title) {
this.title = title;
return this;
}
+ /**
+ * Description builder.
+ *
+ * @param description the description
+ * @return the builder
+ */
public Builder description(String description) {
this.description = description;
return this;
}
+ /**
+ * Menu name builder.
+ *
+ * @param menuName the menu name
+ * @return the builder
+ */
public Builder menuName(String menuName) {
this.menuName = menuName;
return this;
}
+ /**
+ * Server builder.
+ *
+ * @param server the server
+ * @return the builder
+ */
public Builder server(String server) {
this.server = server;
return this;
}
+ /**
+ * Mount point builder.
+ *
+ * @param mountPoint the mount point
+ * @return the builder
+ */
public Builder mountPoint(String mountPoint) {
this.mountPoint = mountPoint;
return this;
}
+ /**
+ * Context root builder.
+ *
+ * @param contextRoot the context root
+ * @return the builder
+ */
public Builder contextRoot(String contextRoot) {
this.contextRoot = contextRoot;
return this;
}
+ /**
+ * Location builder.
+ *
+ * @param location the location
+ * @return the builder
+ */
public Builder location(String location) {
this.location = location;
return this;
}
+ /**
+ * Base permissions builder.
+ *
+ * @param basePermissions the base permissions
+ * @return the builder
+ */
public Builder basePermissions(String[] basePermissions) {
this.basePermissions = basePermissions;
return this;
}
+ /**
+ * Position builder.
+ *
+ * @param position the position
+ * @return the builder
+ */
public Builder position(String position) {
this.position = position;
return this;
}
+ /**
+ * Privileged builder.
+ *
+ * @param privileged the privileged
+ * @return the builder
+ */
public Builder privileged(boolean privileged) {
this.privileged = privileged;
return this;
}
+ /**
+ * App bar display builder.
+ *
+ * @param appBarDisplay the app bar display
+ * @return the builder
+ */
public Builder appBarDisplay(boolean appBarDisplay) {
this.appBarDisplay = appBarDisplay;
return this;
}
+ /**
+ * Access permission builder.
+ *
+ * @param accessPermission the access permission
+ * @return the builder
+ */
public Builder accessPermission(String accessPermission) {
this.accessPermission = accessPermission;
return this;
}
+ /**
+ * Use autologin cookie builder.
+ *
+ * @param useAutologinCookie the use autologin cookie
+ * @return the builder
+ */
public Builder useAutologinCookie(boolean useAutologinCookie) {
this.useAutologinCookie = useAutologinCookie;
return this;
}
+ /**
+ * Create webapp info.
+ *
+ * @return the webapp info
+ */
public WebappInfo create() {
return new WebappInfo(this);
}
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentLoaderConfig.java b/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentLoaderConfig.java
index ec22ae2..1caf8db 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentLoaderConfig.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentLoaderConfig.java
@@ -61,7 +61,6 @@ public final class ComponentLoaderConfig {
/**
* Provides the list of root directory components defined in the classpath.
- *
* @return the list of root directory components.
* @throws ComponentException if the main {@code component-load.xml} file is either invalid
* or refer to non-existent component directory.
@@ -73,7 +72,6 @@ public final class ComponentLoaderConfig {
/**
* Collects the component definitions from a {@code component-load.xml} file
- *
* @param configUrl the location of the {@code component-load.xml} file
* @return a list of component definitions
* @throws ComponentException when the {@code component-load.xml} file is invalid.
@@ -100,7 +98,6 @@ public final class ComponentLoaderConfig {
/**
* Constructs a component definition.
- *
* @param location the location of the component
* @param type the type of the component
*/
@@ -116,7 +113,6 @@ public final class ComponentLoaderConfig {
/**
* Converts a string based location to a proper {@code Path}.
- *
* @param location the string based location
* @return the corresponding {@code Path} object.
*/
@@ -127,7 +123,6 @@ public final class ComponentLoaderConfig {
/**
* Constructs a component definition object from an XML element.
- *
* @param element an XML element which must have either a "load-component" or "load-components" label.
* @param configUrl the location of the file containing the XML element
* @return the corresponding component definition object.
@@ -151,7 +146,6 @@ public final class ComponentLoaderConfig {
/**
* Parses a {@code component-load.xml} resource.
- *
* @param configUrl the {@code component-load.xml} resource.
* @return the parsed XML document
* @throws ComponentException when {@code configUrl} is {@code null} or is invalid.
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 6d6c8c4..375b4df 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
@@ -41,9 +41,11 @@ import org.apache.ofbiz.base.util.Debug;
@SourceMonitored
public final class ExecutionPool {
private static final String MODULE = ExecutionPool.class.getName();
- public static final ExecutorService GLOBAL_BATCH = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 5, TimeUnit.SECONDS, new SynchronousQueue<>(), new ExecutionPoolThreadFactory(null, "OFBiz-batch"));
+ public static final ExecutorService GLOBAL_BATCH = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 5, TimeUnit.SECONDS, new SynchronousQueue<>(),
+ new ExecutionPoolThreadFactory(null, "OFBiz-batch"));
public static final ForkJoinPool GLOBAL_FORK_JOIN = new ForkJoinPool();
- private static final ExecutorService pulseExecutionPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), new ExecutionPoolThreadFactory(null, "OFBiz-ExecutionPoolPulseWorker"));
+ private static final ExecutorService PULSE_EXECUTION_POOL = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(),
+ new ExecutionPoolThreadFactory(null, "OFBiz-ExecutionPoolPulseWorker"));
protected static class ExecutionPoolThreadFactory implements ThreadFactory {
private final ThreadGroup group;
@@ -65,7 +67,8 @@ public final class ExecutionPool {
}
}
- public static ScheduledExecutorService getScheduledExecutor(ThreadGroup group, String namePrefix, int threadCount, long keepAliveSeconds, boolean preStart) {
+ public static ScheduledExecutorService getScheduledExecutor(ThreadGroup group, String namePrefix, int threadCount, long keepAliveSeconds,
+ boolean preStart) {
ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(threadCount, new ExecutionPoolThreadFactory(group, namePrefix));
if (keepAliveSeconds > 0) {
executor.setKeepAliveTime(keepAliveSeconds, TimeUnit.SECONDS);
@@ -90,28 +93,28 @@ public final class ExecutionPool {
}
public static void addPulse(Pulse pulse) {
- delayQueue.put(pulse);
+ DELAY_QUEUE.put(pulse);
}
public static void removePulse(Pulse pulse) {
- delayQueue.remove(pulse);
+ DELAY_QUEUE.remove(pulse);
}
static {
int numberOfExecutionPoolPulseWorkers = Runtime.getRuntime().availableProcessors();
for (int i = 0; i < numberOfExecutionPoolPulseWorkers; i++) {
- pulseExecutionPool.execute(new ExecutionPoolPulseWorker());
+ PULSE_EXECUTION_POOL.execute(new ExecutionPoolPulseWorker());
}
}
- private static final DelayQueue<Pulse> delayQueue = new DelayQueue<>();
+ private static final DelayQueue<Pulse> DELAY_QUEUE = new DelayQueue<>();
public static class ExecutionPoolPulseWorker implements Runnable {
@Override
public void run() {
try {
while (true) {
- delayQueue.take().run();
+ DELAY_QUEUE.take().run();
}
} catch (InterruptedException e) {
Debug.logError(e, MODULE);
@@ -120,8 +123,8 @@ public final class ExecutionPool {
}
public abstract static class Pulse implements Delayed, Runnable {
- protected final long expireTimeNanos;
- protected final long loadTimeNanos;
+ private final long expireTimeNanos;
+ private final long loadTimeNanos;
protected Pulse(long delayNanos) {
this(System.nanoTime(), delayNanos);
@@ -132,10 +135,20 @@ public final class ExecutionPool {
expireTimeNanos = loadTimeNanos + delayNanos;
}
+ /**
+ * Gets load time nanos.
+ *
+ * @return the load time nanos
+ */
public long getLoadTimeNanos() {
return loadTimeNanos;
}
+ /**
+ * Gets expire time nanos.
+ *
+ * @return the expire time nanos
+ */
public long getExpireTimeNanos() {
return expireTimeNanos;
}
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/config/JNDIConfigUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/config/JNDIConfigUtil.java
index 9f6bec4..efef439 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/config/JNDIConfigUtil.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/config/JNDIConfigUtil.java
@@ -32,7 +32,7 @@ public final class JNDIConfigUtil {
private static final String MODULE = JNDIConfigUtil.class.getName();
private static final String JNDI_CONFIG_XML_FILENAME = "jndiservers.xml";
- private static final ConcurrentHashMap<String, JndiServerInfo> jndiServerInfos = new ConcurrentHashMap<>();
+ private static final ConcurrentHashMap<String, JndiServerInfo> JNDI_SERVER_INFOS = new ConcurrentHashMap<>();
private JNDIConfigUtil() { }
private static Element getXmlRootElement() throws GenericConfigException {
@@ -51,25 +51,45 @@ public final class JNDIConfigUtil {
}
}
public static void initialize(Element rootElement) {
- // jndi-server - jndiServerInfos
+ // jndi-server - JNDI_SERVER_INFOS
for (Element curElement: UtilXml.childElementList(rootElement, "jndi-server")) {
JndiServerInfo jndiServerInfo = new JndiServerInfo(curElement);
- jndiServerInfos.putIfAbsent(jndiServerInfo.name, jndiServerInfo);
+ JNDI_SERVER_INFOS.putIfAbsent(jndiServerInfo.name, jndiServerInfo);
}
}
public static JndiServerInfo getJndiServerInfo(String name) {
- return jndiServerInfos.get(name);
+ return JNDI_SERVER_INFOS.get(name);
}
public static final class JndiServerInfo {
- public final String name;
- public final String contextProviderUrl;
- public final String initialContextFactory;
- public final String urlPkgPrefixes;
- public final String securityPrincipal;
- public final String securityCredentials;
+ private final String name;
+ private final String contextProviderUrl;
+ private final String initialContextFactory;
+ private final String urlPkgPrefixes;
+ private final String securityPrincipal;
+ private final String securityCredentials;
+
+ public String getContextProviderUrl() {
+ return contextProviderUrl;
+ }
+
+ public String getInitialContextFactory() {
+ return initialContextFactory;
+ }
+
+ public String getUrlPkgPrefixes() {
+ return urlPkgPrefixes;
+ }
+
+ public String getSecurityPrincipal() {
+ return securityPrincipal;
+ }
+
+ public String getSecurityCredentials() {
+ return securityCredentials;
+ }
public JndiServerInfo(Element element) {
this.name = element.getAttribute("name");
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/container/ComponentContainer.java b/framework/base/src/main/java/org/apache/ofbiz/base/container/ComponentContainer.java
index 29c0125..60392ff 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/container/ComponentContainer.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/container/ComponentContainer.java
@@ -59,7 +59,6 @@ public class ComponentContainer implements Container {
/**
* Loads components found in a directory.
- *
* @param name the name of this container
* @param ofbizHome the directory where to search for components
* @throws ContainerException when components are already loaded or when failing to load them.
@@ -89,7 +88,6 @@ public class ComponentContainer implements Container {
/**
* Loads any kind of component definition.
- *
* @param dir the location where the component should be loaded
* @param component a single component or a component directory definition
* @throws IOException when component directory loading fails.
@@ -109,7 +107,6 @@ public class ComponentContainer implements Container {
/**
* Checks to see if the directory contains a load file (component-load.xml) and
* then delegates loading to the appropriate method
- *
* @param directoryName the name of component directory to load
* @throws IOException
*/
@@ -133,7 +130,6 @@ public class ComponentContainer implements Container {
* load components residing in a directory only if they exist in the component
* load file (component-load.xml) and they are sorted in order from top to bottom
* in the load file
- *
* @param directoryPath the absolute path of the directory
* @param componentLoadFile the name of the load file (i.e. component-load.xml)
* @throws IOException
@@ -157,7 +153,6 @@ public class ComponentContainer implements Container {
* Load all components in a directory because it does not contain
* a load-components.xml file. The components are sorted alphabetically
* for loading purposes
- *
* @param directoryPath a valid absolute path of a component directory
* @throws IOException if an I/O error occurs when opening the directory
*/
@@ -173,7 +168,6 @@ public class ComponentContainer implements Container {
/**
* Fetch the <code>ComponentConfig</code> for a certain component
- *
* @param location directory location of the component which cannot be {@code null}
* @return The component configuration
*/
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/container/Container.java b/framework/base/src/main/java/org/apache/ofbiz/base/container/Container.java
index 579f84d..7db6f1f 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/container/Container.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/container/Container.java
@@ -42,7 +42,6 @@ public interface Container {
/** Initialize the container. This method must not block - implementations
* should initialize internal structures and then return.
- *
* @param ofbizCommands Command-line arguments.
* @param name Unique name of the container's instance.
* @param configFile always {@code null} but used to be the location of the global
@@ -57,7 +56,6 @@ public interface Container {
/**
* Start the container process. This method must not block - implementations
* that require thread blocking must create a separate thread and then return.
- *
* @return <code>true</code> if the process started.
* @throws ContainerException If an error was encountered.
*/
@@ -65,14 +63,12 @@ public interface Container {
/**
* Stop the container process. This method must not block.
- *
* @throws ContainerException If an error was encountered.
*/
void stop() throws ContainerException;
/**
* Return the container name.
- *
* @return Name of the container's instance.
*/
String getName();
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerConfig.java b/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerConfig.java
index 8246d29..565288c 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerConfig.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerConfig.java
@@ -45,7 +45,6 @@ public final class ContainerConfig {
/**
* Retrieves the container configuration element corresponding to a container name.
- *
* @param containerName the name of the container to retrieve
* @param configFile the file name corresponding to the global container configuration file
* @return the corresponding configuration element.
@@ -60,7 +59,6 @@ public final class ContainerConfig {
/**
* Retrieves the container configuration element corresponding to a container name.
- *
* @param containerName the name of the container to retrieve
* @return the corresponding configuration element.
* @throws ContainerException when no configuration element are found.
@@ -75,7 +73,6 @@ public final class ContainerConfig {
/**
* Finds the {@code <container>} configuration elements in a XML element.
- *
* @param root the XML element which cannot be {@code null}
* @return a list of container configuration
*/
@@ -120,7 +117,6 @@ public final class ContainerConfig {
interface PropertyChildren {
/**
* Provides the child property corresponding to a specified identifier.
- *
* @param name the child property identifier
* @return the property corresponding to {@code name} or {@code null} if the identifier is absent.
*/
@@ -156,7 +152,6 @@ public final class ContainerConfig {
/**
* Constructs a container configuration.
- *
* @param element the {@code <container>} XML element to parse
*/
public Configuration(Element element) {
@@ -198,7 +193,6 @@ public final class ContainerConfig {
}
/**
* Provides all the child properties whose values are equal a specified value.
- *
* @param value the value to match
* @return a list of matching properties
*/
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java b/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java
index 403fe26..85e54d7 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/container/ContainerLoader.java
@@ -53,7 +53,6 @@ public class ContainerLoader {
/**
* Starts the containers.
- *
* @param config Startup config
* @param ofbizCommands Command-line arguments
* @throws StartupException If an error was encountered. Throwing this exception
@@ -80,7 +79,6 @@ public class ContainerLoader {
/**
* Checks if two collections have an intersection or are both empty.
- *
* @param a the first collection which can be {@code null}
* @param b the second collection which can be {@code null}
* @return {@code true} if {@code a} and {@code b} have an intersection or are both empty.
@@ -92,7 +90,6 @@ public class ContainerLoader {
/**
* Loads the available containers which are matching the configured loaders.
- *
* @param loaders the collection of loaders to match
* @param ofbizCommands the parsed commands line arguments used by the containers
* @return a list of loaded containers.
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 37d2a6f..9ebf127 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
@@ -29,7 +29,6 @@ public interface Converter<S, T> {
* <code>sourceClass</code> to <code>targetClass</code>.
* <p>Implementations can accomodate class hierarchy ranges
* by converting super classes or interfaces.</p>
- *
* @param sourceClass The source <code>Class</code>
* @param targetClass The target <code>Class</code>
* @return <code>true</code> if this object can convert
@@ -38,7 +37,6 @@ public interface Converter<S, T> {
boolean canConvert(Class<?> sourceClass, Class<?> targetClass);
/** Converts <code>obj</code> to <code>T</code>.
- *
* @param obj The source <code>Object</code> to convert
* @return The converted <code>Object</code>
* @throws ConversionException
@@ -46,7 +44,6 @@ public interface Converter<S, T> {
T convert(S obj) throws ConversionException;
/** Converts <code>obj</code> to <code>T</code>.
- *
* @param targetClass The <code>Class</code> to convert to
* @param obj The source <code>Object</code> to convert
* @return The converted <code>Object</code>
@@ -55,13 +52,11 @@ public interface Converter<S, T> {
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
*/
Class<?> getSourceClass();
/** Returns the target <code>Class</code> for this converter.
- *
* @return The target <code>Class</code> for this converter
*/
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 510115d..9472698 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
@@ -25,7 +25,6 @@ public interface ConverterCreator {
/** Creates a Converter that can convert the <code>sourceClass</code> to
* the <code>targetClass</code>. Returns <code>null</code> if this creater
* doesn't support the class pair.
- *
* @param sourceClass The source <code>Class</code> to convert
* @param targetClass The target <code>Class</code> to convert to
* @return a converter that can convert <code>Object</code>s
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 ac3b6a4..73195d6 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
@@ -29,7 +29,6 @@ public interface ConverterLoader {
* itself when an instance is created. Otherwise, call
* {@link org.apache.ofbiz.base.conversion.Converters#registerConverter(Converter)}
* with the <code>Converter</code> instance.
- *
*/
void loadConverters();
}
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/Converters.java b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/Converters.java
index 78d46a4..af64858 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/Converters.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/Converters.java
@@ -32,11 +32,11 @@ import org.apache.ofbiz.base.util.UtilGenerics;
/** A <code>Converter</code> factory and repository. */
@SourceMonitored
public class Converters {
- protected static final String MODULE = Converters.class.getName();
- protected static final String DELIMITER = "->";
- protected static final ConcurrentHashMap<String, Converter<?, ?>> converterMap = new ConcurrentHashMap<>();
- private static final Set<ConverterCreator> creators = new HashSet<>();
- private static final Set<String> noConversions = new HashSet<>();
+ private static final String MODULE = Converters.class.getName();
+ private static final String DELIMITER = "->";
+ private static final ConcurrentHashMap<String, Converter<?, ?>> CONVERTER_MAP = new ConcurrentHashMap<>();
+ private static final Set<ConverterCreator> CREATORS = new HashSet<>();
+ private static final Set<String> NO_CONVERSIONS = new HashSet<>();
static {
registerCreator(new PassThruConverterCreator());
@@ -58,12 +58,10 @@ public class Converters {
* <code>sourceClass</code> and <code>targetClass</code>. If no matching
* <code>Converter</code> is found, the method throws
* <code>ClassNotFoundException</code>.
- *
* <p>This method is intended to be used when the source or
* target <code>Object</code> types are unknown at compile time.
* If the source and target <code>Object</code> types are known
* at compile time, then one of the "ready made" converters should be used.</p>
- *
* @param sourceClass The object class to convert from
* @param targetClass The object class to convert to
* @return A matching <code>Converter</code> instance
@@ -76,16 +74,16 @@ public class Converters {
}
OUTER:
do {
- Converter<?, ?> result = converterMap.get(key);
+ Converter<?, ?> result = CONVERTER_MAP.get(key);
if (result != null) {
return UtilGenerics.cast(result);
}
- if (noConversions.contains(key)) {
+ if (NO_CONVERSIONS.contains(key)) {
throw new ClassNotFoundException("No converter found for " + key);
}
Class<?> foundSourceClass = null;
Converter<?, ?> foundConverter = null;
- for (Converter<?, ?> value : converterMap.values()) {
+ for (Converter<?, ?> value : CONVERTER_MAP.values()) {
if (value.canConvert(sourceClass, targetClass)) {
// this converter can deal with the source/target pair
if (foundSourceClass == null || foundSourceClass.isAssignableFrom(value.getSourceClass())) {
@@ -98,19 +96,19 @@ public class Converters {
}
}
if (foundConverter != null) {
- converterMap.putIfAbsent(key, foundConverter);
+ CONVERTER_MAP.putIfAbsent(key, foundConverter);
continue OUTER;
}
- for (ConverterCreator value : creators) {
+ for (ConverterCreator value : CREATORS) {
result = createConverter(value, sourceClass, targetClass);
if (result != null) {
- converterMap.putIfAbsent(key, result);
+ CONVERTER_MAP.putIfAbsent(key, result);
continue OUTER;
}
}
boolean addedToSet = false;
- synchronized (noConversions) {
- addedToSet = noConversions.add(key);
+ synchronized (NO_CONVERSIONS) {
+ addedToSet = NO_CONVERSIONS.add(key);
}
if (addedToSet) {
Debug.logWarning("*** No converter found, converting from "
@@ -128,7 +126,6 @@ public class Converters {
/** Load all classes that implement <code>Converter</code> and are
* contained in <code>containerClass</code>.
- *
* @param containerClass
*/
public static void loadContainedConverters(Class<?> containerClass) {
@@ -159,21 +156,19 @@ public class Converters {
/** Registers a <code>ConverterCreater</code> instance to be used by the
* {@link org.apache.ofbiz.base.conversion.Converters#getConverter(Class, Class)}
* method, when a converter can't be found.
- *
* @param <S> The source object type
* @param <T> The target object type
* @param creator The <code>ConverterCreater</code> instance to register
*/
public static <S, T> void registerCreator(ConverterCreator creator) {
- synchronized (creators) {
- creators.add(creator);
+ synchronized (CREATORS) {
+ CREATORS.add(creator);
}
}
/** Registers a <code>Converter</code> instance to be used by the
* {@link org.apache.ofbiz.base.conversion.Converters#getConverter(Class, Class)}
* method.
- *
* @param <S> The source object type
* @param <T> The target object type
* @param converter The <code>Converter</code> instance to register
@@ -192,7 +187,7 @@ public class Converters {
sb.append(DELIMITER);
sb.append(targetClass.getName());
String key = sb.toString();
- if (converterMap.putIfAbsent(key, converter) == null) {
+ if (CONVERTER_MAP.putIfAbsent(key, converter) == null) {
if (Debug.verboseOn()) {
Debug.logVerbose("Registered converter " + converter.getClass().getName(), MODULE);
}
@@ -215,7 +210,6 @@ public class Converters {
/** Pass thru converter used when the source and target java object
* types are the same. The <code>convert</code> method returns the
* source object.
- *
*/
protected static class PassThruConverter<S, T> implements Converter<S, T> {
private final Class<S> sourceClass;
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/LocalizedConverter.java b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/LocalizedConverter.java
index 58f4a34..38cb2d3 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/LocalizedConverter.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/LocalizedConverter.java
@@ -27,7 +27,6 @@ import java.util.TimeZone;
*/
public interface LocalizedConverter<S, T> extends Converter<S, T> {
/** Converts <code>obj</code> to <code>T</code>.
- *
* @param obj The source <code>Object</code> to convert
* @param locale The locale used for conversion - must not be <code>null</code>
* @param timeZone The time zone used for conversion - must not be <code>null</code>
@@ -37,7 +36,6 @@ public interface LocalizedConverter<S, T> extends Converter<S, T> {
T convert(S obj, Locale locale, TimeZone timeZone) throws ConversionException;
/** Converts <code>obj</code> to <code>T</code>.
- *
* @param targetClass The <code>Class</code> to convert to
* @param obj The source <code>Object</code> to convert
* @param locale The locale used for conversion - must not be <code>null</code>
@@ -48,7 +46,6 @@ public interface LocalizedConverter<S, T> extends Converter<S, T> {
T convert(Class<? extends T> targetClass, S obj, Locale locale, TimeZone timeZone) throws ConversionException;
/** Converts <code>obj</code> to <code>T</code>.
- *
* @param obj The source <code>Object</code> to convert
* @param locale The locale used for conversion - must not be <code>null</code>
* @param timeZone The time zone used for conversion - must not be <code>null</code>
@@ -59,7 +56,6 @@ public interface LocalizedConverter<S, T> extends Converter<S, T> {
T convert(S obj, Locale locale, TimeZone timeZone, String formatString) throws ConversionException;
/** Converts <code>obj</code> to <code>T</code>.
- *
* @param targetClass The <code>Class</code> to convert to
* @param obj The source <code>Object</code> to convert
* @param locale The locale used for conversion - must not be <code>null</code>
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 64c66e9..f023ce7 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
@@ -374,8 +374,8 @@ public class MiscConverters implements ConverterLoader {
}
}
- public static class NotAConverter_Helper {
- protected NotAConverter_Helper() {
+ public static class NotAConverterHelper {
+ protected NotAConverterHelper() {
throw new Error("Should not be loaded");
}
}
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/html/CustomPermissivePolicy.java b/framework/base/src/main/java/org/apache/ofbiz/base/html/CustomPermissivePolicy.java
index d07455b..ef41e7b 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/html/CustomPermissivePolicy.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/html/CustomPermissivePolicy.java
@@ -175,7 +175,6 @@ public class CustomPermissivePolicy implements SanitizerCustomPolicy {
/**
* Constructs a predicate checking if a string matches any of the two provided patterns.
- *
* @param a the first pattern
* @param b the second pattern
* @return a predicate checking if a string matches either {@code a} or {@code b}
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 6a8446a..bc0d827 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
@@ -35,7 +35,6 @@ public interface SanitizerCustomPolicy {
/**
* Used for getting the policy from the custom class which implements this
* interface
- *
* @return the policy specified in the class will be returned
*/
PolicyFactory getSanitizerPolicy();
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/lang/Factory.java b/framework/base/src/main/java/org/apache/ofbiz/base/lang/Factory.java
index f17e45a..29b073c 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/lang/Factory.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/lang/Factory.java
@@ -25,7 +25,6 @@ public interface Factory<R, A> {
* that is meant to be extended. Sub-interfaces declare types for
* <code>A</code> (the <code>getInstance</code> argument), and
* <code>R</code> (the type returned by <code>getInstance</code>).
- *
* @param obj Optional object to be used in <code>R</code>'s construction,
* or to be used as a selector key
* @return An instance of <code>R</code>
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/lang/JSON.java b/framework/base/src/main/java/org/apache/ofbiz/base/lang/JSON.java
index d9f7010..04e9aeb 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/lang/JSON.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/lang/JSON.java
@@ -31,13 +31,12 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@ThreadSafe
public final class JSON {
- // TODO: Find a generic way to modify mapper options
- private static final ObjectMapper mapper = new ObjectMapper();
+ // TODO: Find a generic way to modify MAPPER options
+ private static final ObjectMapper MAPPER = new ObjectMapper();
/**
* Creates a <code>JSON</code> instance from an <code>InputStream</code>.
* The method assumes the character set is UTF-8.
- *
* @param inStream
* @return a <code>JSON</code> instance
* @throws IOException
@@ -50,7 +49,6 @@ public final class JSON {
/**
* Creates a <code>JSON</code> instance from an unknown data type.
- *
* @param object
* @return a <code>JSON</code> instance
* @throws IOException
@@ -58,7 +56,7 @@ public final class JSON {
public static JSON from(Object object) throws IOException {
Assert.notNull("object", object);
try {
- return from(mapper.writeValueAsString(object));
+ return from(MAPPER.writeValueAsString(object));
} catch (Exception e) {
throw new IOException(e);
}
@@ -66,7 +64,6 @@ public final class JSON {
/**
* Creates a <code>JSON</code> instance from a <code>Reader</code>.
- *
* @param reader
* @return a <code>JSON</code> instance
* @throws IOException
@@ -79,7 +76,6 @@ public final class JSON {
/**
* Creates a <code>JSON</code> instance from a <code>String</code>.
- *
* @param jsonString
* @return a <code>JSON</code> instance
*/
@@ -113,7 +109,6 @@ public final class JSON {
/**
* Converts this <code>JSON</code> object to the specified type.
- *
* @param targetClass
* @return an object of the specified type
* @throws IOException
@@ -121,7 +116,7 @@ public final class JSON {
public <T> T toObject(Class<T> targetClass) throws IOException {
Assert.notNull("targetClass", targetClass);
try {
- return mapper.readValue(jsonString, targetClass);
+ return MAPPER.readValue(jsonString, targetClass);
} catch (IOException e) {
throw e;
} catch (Exception e) {
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/lang/Range.java b/framework/base/src/main/java/org/apache/ofbiz/base/lang/Range.java
index 24612d7..a3a0609 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/lang/Range.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/lang/Range.java
@@ -22,7 +22,6 @@ package org.apache.ofbiz.base.lang;
public interface Range<T> {
/** Returns <code>true</code> if the lowest value in this range
* occurs after the greatest value in <code>range</code>.
- *
* @param range The range to test
* @return <code>true</code> if the lowest value in this range
* occurs after the greatest value in <code>range</code>
@@ -30,7 +29,6 @@ public interface Range<T> {
boolean after(Range<T> range);
/** Returns <code>true</code> if this range occurs after <code>value</code>.
- *
* @param value The value to test
* @return <code>true</code> if this range occurs after <code>value</code>
*/
@@ -38,7 +36,6 @@ public interface Range<T> {
/** Returns <code>true</code> if the greatest value in this range
* occurs before the lowest value in <code>range</code>.
- *
* @param range The range to test
* @return <code>true</code> if the greatest value in this range
* occurs before the lowest value in <code>range</code>
@@ -46,47 +43,40 @@ public interface Range<T> {
boolean before(Range<T> range);
/** Returns <code>true</code> if this range occurs before <code>value</code>.
- *
* @param value The value to test
* @return <code>true</code> if this range occurs before <code>value</code>
*/
boolean before(T value);
/** Returns the ending value of this range.
- *
* @return Ending value
*/
T end();
/** Returns <code>true</code> if this range includes <code>range</code>.
- *
* @param range The range to test
* @return <code>true</code> if this range includes <code>range</code>
*/
boolean includes(Range<T> range);
/** Returns <code>true</code> if <code>value</code> occurs within this range.
- *
* @param value The value to test
* @return <code>true</code> if <code>value</code> occurs within this range
*/
boolean includes(T value);
/** Returns <code>true</code> if the starting and ending values are equal.
- *
* @return <code>true</code> if the starting and ending values are equal
*/
boolean isPoint();
/** Returns <code>true</code> if this range overlaps <code>range</code>.
- *
* @param range The range to test
* @return <code>true</code> if this range overlaps <code>range</code>
*/
boolean overlaps(Range<T> range);
/** Returns the starting value of this range.
- *
* @return Starting value
*/
T start();
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/location/FlexibleLocation.java b/framework/base/src/main/java/org/apache/ofbiz/base/location/FlexibleLocation.java
index 9f4c58c..0a3cb84 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/location/FlexibleLocation.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/location/FlexibleLocation.java
@@ -37,7 +37,7 @@ import org.apache.ofbiz.base.util.UtilValidate;
public final class FlexibleLocation {
private static final String MODULE = FlexibleLocation.class.getName();
- private static final Map<String, LocationResolver> locationResolvers;
+ private static final Map<String, LocationResolver> LOCATION_RESOLVERS;
static {
Map<String, LocationResolver> resolverMap = new HashMap<>(8);
@@ -68,7 +68,7 @@ public final class FlexibleLocation {
} catch (Throwable e) {
Debug.logError(e, "Exception thrown while loading locationresolvers.properties", MODULE);
}
- locationResolvers = Collections.unmodifiableMap(resolverMap);
+ LOCATION_RESOLVERS = Collections.unmodifiableMap(resolverMap);
}
/**
@@ -87,14 +87,11 @@ public final class FlexibleLocation {
/**
* Resolves the gives location into a URL object for use in various ways.
- *
* The general format of the location is like a URL: {locationType}://location/path/file.ext
- *
* Supports standard locationTypes like http, https, ftp, jar and file
* Supports a classpath location type for when desired to be used like any other URL
* Supports OFBiz specific location types like ofbizhome and component
* Supports additional locationTypes specified in the locationresolvers.properties file
- *
* @param location The location String to parse and create a URL from
* @return URL object corresponding to the location String passed in
* @throws MalformedURLException
@@ -108,7 +105,7 @@ public final class FlexibleLocation {
return null;
}
String locationType = getLocationType(location);
- LocationResolver resolver = locationResolvers.get(locationType);
+ LocationResolver resolver = LOCATION_RESOLVERS.get(locationType);
if (resolver != null) {
if (loader != null && resolver instanceof ClasspathLocationResolver) {
ClasspathLocationResolver cplResolver = (ClasspathLocationResolver) resolver;
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/location/OFBizHomeLocationResolver.java b/framework/base/src/main/java/org/apache/ofbiz/base/location/OFBizHomeLocationResolver.java
index 9d83195..31caa77 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/location/OFBizHomeLocationResolver.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/location/OFBizHomeLocationResolver.java
@@ -31,13 +31,13 @@ import java.net.URL;
public class OFBizHomeLocationResolver implements LocationResolver {
- public static final String envName = "ofbiz.home";
+ public static final String ENV_NAME = "ofbiz.home";
@Override
public URL resolveLocation(String location) throws MalformedURLException {
- String propValue = System.getProperty(envName);
+ String propValue = System.getProperty(ENV_NAME);
if (propValue == null) {
- String errMsg = "The Java environment (-Dxxx=yyy) variable with name " + envName + " is not set, cannot resolve location.";
+ String errMsg = "The Java environment (-Dxxx=yyy) variable with name " + ENV_NAME + " is not set, cannot resolve location.";
throw new MalformedURLException(errMsg);
}
StringBuilder baseLocation = new StringBuilder(FlexibleLocation.stripLocationType(location));
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/metrics/MetricsFactory.java b/framework/base/src/main/java/org/apache/ofbiz/base/metrics/MetricsFactory.java
index 1444518..287a940 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/metrics/MetricsFactory.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/metrics/MetricsFactory.java
@@ -84,7 +84,6 @@ public final class MetricsFactory {
* <td>The metric threshold. The meaning of the threshold is determined by client code.</td>
* <td>Defaults to "0.0".</td></tr>
* </table>
- *
* @param element The element whose attributes will be used to create the <code>Metrics</code> instance
* @return A <code>Metrics</code> instance based on <code>element</code> attributes
* @throws IllegalArgumentException if <code>element</code> is null or if the name attribute is empty
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/Assert.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/Assert.java
index d0912e4..4a7bfd8 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/Assert.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/Assert.java
@@ -33,7 +33,6 @@ public class Assert {
/**
* Tests if an argument is not null and can be cast to a specified class.
* <p><code>Assert.isAssignableTo("foo", foo, Foo.class);</code></p>
- *
* @param argumentName
* @param argumentObject
* @param targetClass
@@ -49,7 +48,6 @@ public class Assert {
/**
* Tests if an argument is not null and is an instance of a specified class.
* <p><code>Assert.isInstanceOf("foo", foo, Foo.class);</code></p>
- *
* @param argumentName
* @param argumentObject
* @param targetClass
@@ -65,7 +63,6 @@ public class Assert {
/**
* Tests if an argument is not null and is an instance of one of the specified classes.
* <p><code>Assert.isInstanceOf("foo", foo, Foo.class, Bar.class, ...);</code></p>
- *
* @param argumentName
* @param argumentObject
* @param targetClasses
@@ -92,7 +89,6 @@ public class Assert {
/**
* Tests if an argument is not null and is not an instance of a specified class.
* <p><code>Assert.isNotInstanceOf("foo", foo, Foo.class);</code></p>
- *
* @param argumentName
* @param argumentObject
* @param targetClass
@@ -108,7 +104,6 @@ public class Assert {
/**
* Tests if an argument is not null and is not an instance of one of the specified classes.
* <p><code>Assert.isNotInstanceOf("foo", foo, Foo.class, Bar.class, ...);</code></p>
- *
* @param argumentName
* @param argumentObject
* @param targetClasses
@@ -127,7 +122,6 @@ public class Assert {
/**
* Tests if an argument is not null and is not empty.
* <p><code>Assert.notEmpty("foo", foo);</code></p>
- *
* @param argumentName
* @param argumentObject
* @throws IllegalArgumentException
@@ -142,7 +136,6 @@ public class Assert {
/**
* Tests if an argument is not null and is not empty.
* <p><code>Assert.notEmpty("foo", foo);</code></p>
- *
* @param argumentName
* @param argumentObject
* @throws IllegalArgumentException
@@ -157,7 +150,6 @@ public class Assert {
/**
* Tests if an argument is not null and is not empty.
* <p><code>Assert.notEmpty("foo", foo);</code></p>
- *
* @param argumentName
* @param argumentObject
* @throws IllegalArgumentException
@@ -172,7 +164,6 @@ public class Assert {
/**
* Tests if an argument is not null and is not empty.
* <p><code>Assert.notEmpty("foo", foo);</code></p>
- *
* @param argumentName
* @param argumentObject
* @throws IllegalArgumentException
@@ -187,7 +178,6 @@ public class Assert {
/**
* Tests a list of arguments for <code>null</code>.
* <p><code>Assert.notNull("foo", foo, "bar", bar, ...);</code></p>
- *
* @param arguments
* @throws IllegalArgumentException
*/
@@ -200,7 +190,6 @@ public class Assert {
/**
* Tests an argument for <code>null</code>.
* <p><code>Assert.notNull("foo", foo);</code></p>
- *
* @param argumentName
* @param objectToTest
* @throws IllegalArgumentException
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/DateRange.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/DateRange.java
index 18a2564..56b78f6 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/DateRange.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/DateRange.java
@@ -34,7 +34,7 @@ public class DateRange extends ComparableRange<Date> implements Serializable {
/** A <code>Date</code> instance initialized to the latest possible date.*/
public static final Date MAX_DATE = UtilDateTime.unmodifiableDate(UtilDateTime.getLatestDate());
/** A <code>DateRange</code> instance initialized to the widest possible range of dates.*/
- public static final DateRange FullRange = new DateRange(MIN_DATE, MAX_DATE);
+ public static final DateRange FULL_RANGE = new DateRange(MIN_DATE, MAX_DATE);
protected static Date timestampToDate(Date date) {
// Testing for equality between a Date instance and a Timestamp instance
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/Debug.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/Debug.java
index 9bca29d..333a9f2 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/Debug.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/Debug.java
@@ -34,8 +34,8 @@ import org.apache.logging.log4j.Logger;
*/
public final class Debug {
- private static final String noModuleModule = "NoModule"; // set to null for previous behavior
- private static final Object[] emptyParams = new Object[0];
+ private static final String NO_MODULE = "NoModule"; // set to null for previous behavior
+ private static final Object[] EMPTY_PARAMS = new Object[0];
public static final int ALWAYS = 0;
public static final int VERBOSE = 1;
@@ -46,30 +46,30 @@ public final class Debug {
public static final int ERROR = 6;
public static final int FATAL = 7;
- private static final String[] levelProps = {"", "print.verbose", "print.timing", "print.info", "print.important", "print.warning", "print.error", "print.fatal"};
- private static final Level[] levelObjs = {Level.OFF, Level.DEBUG, Level.TRACE, Level.INFO, Level.INFO, Level.WARN, Level.ERROR, Level.FATAL};
+ private static final String[] LEVEL_PROPS = {"", "print.verbose", "print.timing", "print.info", "print.important", "print.warning", "print.error", "print.fatal"};
+ private static final Level[] LEVEL_OBJS = {Level.OFF, Level.DEBUG, Level.TRACE, Level.INFO, Level.INFO, Level.WARN, Level.ERROR, Level.FATAL};
- private static final Map<String, Integer> levelStringMap = new HashMap<>();
+ private static final Map<String, Integer> LEVEL_STRING_MAP = new HashMap<>();
- private static final boolean levelOnCache[] = new boolean[8]; // this field is not thread safe
+ private static final boolean LEVEL_ON_CACHE[] = new boolean[8]; // this field is not thread safe
- private static final Logger root = LogManager.getRootLogger();
+ private static final Logger ROOT = LogManager.getRootLogger();
static {
- levelStringMap.put("verbose", Debug.VERBOSE);
- levelStringMap.put("timing", Debug.TIMING);
- levelStringMap.put("info", Debug.INFO);
- levelStringMap.put("important", Debug.IMPORTANT);
- levelStringMap.put("warning", Debug.WARNING);
- levelStringMap.put("error", Debug.ERROR);
- levelStringMap.put("fatal", Debug.FATAL);
- levelStringMap.put("always", Debug.ALWAYS);
-
- // initialize levelOnCache
+ LEVEL_STRING_MAP.put("verbose", Debug.VERBOSE);
+ LEVEL_STRING_MAP.put("timing", Debug.TIMING);
+ LEVEL_STRING_MAP.put("info", Debug.INFO);
+ LEVEL_STRING_MAP.put("important", Debug.IMPORTANT);
+ LEVEL_STRING_MAP.put("warning", Debug.WARNING);
+ LEVEL_STRING_MAP.put("error", Debug.ERROR);
+ LEVEL_STRING_MAP.put("fatal", Debug.FATAL);
+ LEVEL_STRING_MAP.put("always", Debug.ALWAYS);
+
+ // initialize LEVEL_ON_CACHE
Properties properties = UtilProperties.createProperties("debug.properties");
if (properties != null) {
- for (int i = 0; i < levelOnCache.length; i++) {
- levelOnCache[i] = (i == Debug.ALWAYS || "true".equalsIgnoreCase(properties.getProperty(levelProps[i])));
+ for (int i = 0; i < LEVEL_ON_CACHE.length; i++) {
+ LEVEL_ON_CACHE[i] = (i == Debug.ALWAYS || "true".equalsIgnoreCase(properties.getProperty(LEVEL_PROPS[i])));
}
} else {
throw new IllegalStateException("debug.properties file not found");
@@ -80,7 +80,7 @@ public final class Debug {
if (UtilValidate.isNotEmpty(module)) {
return LogManager.getLogger(module);
}
- return root;
+ return ROOT;
}
/** Gets an Integer representing the level number from a String representing the level name; will return null if not found */
@@ -88,11 +88,11 @@ public final class Debug {
if (levelName == null) {
return null;
}
- return levelStringMap.get(levelName.toLowerCase(Locale.getDefault()));
+ return LEVEL_STRING_MAP.get(levelName.toLowerCase(Locale.getDefault()));
}
public static void log(int level, Throwable t, String msg, String module) {
- log(level, t, msg, module, "org.apache.ofbiz.base.util.Debug", emptyParams);
+ log(level, t, msg, module, "org.apache.ofbiz.base.util.Debug", EMPTY_PARAMS);
}
public static void log(int level, Throwable t, String msg, String module, Object... params) {
@@ -115,29 +115,29 @@ public final class Debug {
// log
Logger logger = getLogger(module);
- logger.log(levelObjs[level], msg, t);
+ logger.log(LEVEL_OBJS[level], msg, t);
}
}
public static boolean isOn(int level) {
- return levelOnCache[level];
+ return LEVEL_ON_CACHE[level];
}
// leaving these here
public static void log(String msg) {
- log(Debug.ALWAYS, null, msg, noModuleModule, emptyParams);
+ log(Debug.ALWAYS, null, msg, NO_MODULE, EMPTY_PARAMS);
}
public static void log(String msg, Object... params) {
- log(Debug.ALWAYS, null, msg, noModuleModule, params);
+ log(Debug.ALWAYS, null, msg, NO_MODULE, params);
}
public static void log(Throwable t) {
- log(Debug.ALWAYS, t, null, noModuleModule, emptyParams);
+ log(Debug.ALWAYS, t, null, NO_MODULE, EMPTY_PARAMS);
}
public static void log(String msg, String module) {
- log(Debug.ALWAYS, null, msg, module, emptyParams);
+ log(Debug.ALWAYS, null, msg, module, EMPTY_PARAMS);
}
public static void log(String msg, String module, Object... params) {
@@ -145,11 +145,11 @@ public final class Debug {
}
public static void log(Throwable t, String module) {
- log(Debug.ALWAYS, t, null, module, emptyParams);
+ log(Debug.ALWAYS, t, null, module, EMPTY_PARAMS);
}
public static void log(Throwable t, String msg, String module) {
- log(Debug.ALWAYS, t, msg, module, emptyParams);
+ log(Debug.ALWAYS, t, msg, module, EMPTY_PARAMS);
}
public static void log(Throwable t, String msg, String module, Object... params) {
@@ -161,7 +161,7 @@ public final class Debug {
}
public static void logVerbose(String msg, String module) {
- log(Debug.VERBOSE, null, msg, module, emptyParams);
+ log(Debug.VERBOSE, null, msg, module, EMPTY_PARAMS);
}
public static void logVerbose(String msg, String module, Object... params) {
@@ -169,11 +169,11 @@ public final class Debug {
}
public static void logVerbose(Throwable t, String module) {
- log(Debug.VERBOSE, t, null, module, emptyParams);
+ log(Debug.VERBOSE, t, null, module, EMPTY_PARAMS);
}
public static void logVerbose(Throwable t, String msg, String module) {
- log(Debug.VERBOSE, t, msg, module, emptyParams);
+ log(Debug.VERBOSE, t, msg, module, EMPTY_PARAMS);
}
public static void logVerbose(Throwable t, String msg, String module, Object... params) {
@@ -185,7 +185,7 @@ public final class Debug {
}
public static void logTiming(String msg, String module) {
- log(Debug.TIMING, null, msg, module, emptyParams);
+ log(Debug.TIMING, null, msg, module, EMPTY_PARAMS);
}
public static void logTiming(String msg, String module, Object... params) {
@@ -193,11 +193,11 @@ public final class Debug {
}
public static void logTiming(Throwable t, String module) {
- log(Debug.TIMING, t, null, module, emptyParams);
+ log(Debug.TIMING, t, null, module, EMPTY_PARAMS);
}
public static void logTiming(Throwable t, String msg, String module) {
- log(Debug.TIMING, t, msg, module, emptyParams);
+ log(Debug.TIMING, t, msg, module, EMPTY_PARAMS);
}
public static void logTiming(Throwable t, String msg, String module, Object... params) {
@@ -209,7 +209,7 @@ public final class Debug {
}
public static void logInfo(String msg, String module) {
- log(Debug.INFO, null, msg, module, emptyParams);
+ log(Debug.INFO, null, msg, module, EMPTY_PARAMS);
}
public static void logInfo(String msg, String module, Object... params) {
@@ -217,11 +217,11 @@ public final class Debug {
}
public static void logInfo(Throwable t, String module) {
- log(Debug.INFO, t, null, module, emptyParams);
+ log(Debug.INFO, t, null, module, EMPTY_PARAMS);
}
public static void logInfo(Throwable t, String msg, String module) {
- log(Debug.INFO, t, msg, module, emptyParams);
+ log(Debug.INFO, t, msg, module, EMPTY_PARAMS);
}
public static void logInfo(Throwable t, String msg, String module, Object... params) {
@@ -233,7 +233,7 @@ public final class Debug {
}
public static void logImportant(String msg, String module) {
- log(Debug.IMPORTANT, null, msg, module, emptyParams);
+ log(Debug.IMPORTANT, null, msg, module, EMPTY_PARAMS);
}
public static void logImportant(String msg, String module, Object... params) {
@@ -241,11 +241,11 @@ public final class Debug {
}
public static void logImportant(Throwable t, String module) {
- log(Debug.IMPORTANT, t, null, module, emptyParams);
+ log(Debug.IMPORTANT, t, null, module, EMPTY_PARAMS);
}
public static void logImportant(Throwable t, String msg, String module) {
- log(Debug.IMPORTANT, t, msg, module, emptyParams);
+ log(Debug.IMPORTANT, t, msg, module, EMPTY_PARAMS);
}
public static void logImportant(Throwable t, String msg, String module, Object... params) {
@@ -257,7 +257,7 @@ public final class Debug {
}
public static void logWarning(String msg, String module) {
- log(Debug.WARNING, null, msg, module, emptyParams);
+ log(Debug.WARNING, null, msg, module, EMPTY_PARAMS);
}
public static void logWarning(String msg, String module, Object... params) {
@@ -265,11 +265,11 @@ public final class Debug {
}
public static void logWarning(Throwable t, String module) {
- log(Debug.WARNING, t, null, module, emptyParams);
+ log(Debug.WARNING, t, null, module, EMPTY_PARAMS);
}
public static void logWarning(Throwable t, String msg, String module) {
- log(Debug.WARNING, t, msg, module, emptyParams);
+ log(Debug.WARNING, t, msg, module, EMPTY_PARAMS);
}
public static void logWarning(Throwable t, String msg, String module, Object... params) {
@@ -281,7 +281,7 @@ public final class Debug {
}
public static void logError(String msg, String module) {
- log(Debug.ERROR, null, msg, module, emptyParams);
+ log(Debug.ERROR, null, msg, module, EMPTY_PARAMS);
}
public static void logError(String msg, String module, Object... params) {
@@ -289,11 +289,11 @@ public final class Debug {
}
public static void logError(Throwable t, String module) {
- log(Debug.ERROR, t, null, module, emptyParams);
+ log(Debug.ERROR, t, null, module, EMPTY_PARAMS);
}
public static void logError(Throwable t, String msg, String module) {
- log(Debug.ERROR, t, msg, module, emptyParams);
+ log(Debug.ERROR, t, msg, module, EMPTY_PARAMS);
}
public static void logError(Throwable t, String msg, String module, Object... params) {
@@ -305,7 +305,7 @@ public final class Debug {
}
public static void logFatal(String msg, String module) {
- log(Debug.FATAL, null, msg, module, emptyParams);
+ log(Debug.FATAL, null, msg, module, EMPTY_PARAMS);
}
public static void logFatal(String msg, String module, Object... params) {
@@ -313,11 +313,11 @@ public final class Debug {
}
public static void logFatal(Throwable t, String module) {
- log(Debug.FATAL, t, null, module, emptyParams);
+ log(Debug.FATAL, t, null, module, EMPTY_PARAMS);
}
public static void logFatal(Throwable t, String msg, String module) {
- log(Debug.FATAL, t, msg, module, emptyParams);
+ log(Debug.FATAL, t, msg, module, EMPTY_PARAMS);
}
public static void logFatal(Throwable t, String msg, String module, Object... params) {
@@ -325,10 +325,10 @@ public final class Debug {
}
public static void set(int level, boolean on) {
- levelOnCache[level] = on;
+ LEVEL_ON_CACHE[level] = on;
}
public static boolean get(int level) {
- return levelOnCache[level];
+ return LEVEL_ON_CACHE[level];
}
}
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/Digraph.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/Digraph.java
index 8314ef1..15f278c 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/Digraph.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/Digraph.java
@@ -47,7 +47,6 @@ public class Digraph<T> {
/**
* Constructs a directed graph from a specification Map.
- *
* @param spec the map defining a set of source nodes (keys) that are linked to a collection
* of adjacent target nodes (values). Both keys and values must not be {@code null}.
* @throws IllegalArgumentException when a target node is not present in the sources nodes.
@@ -70,7 +69,6 @@ public class Digraph<T> {
* Sort nodes in a topological ordering assuming that this graph is acyclic.
* <p>
* A graph without cycles is often called a <em>Directed Acyclic Graph</em> (DAG).
- *
* @return a linear ordering of nodes such for every edge in the graph its target node
* is present before its source node.
* @throws IllegalStateException when this graph contains a cycle.
@@ -91,7 +89,6 @@ public class Digraph<T> {
/**
* Traverses the graph using <em>Depth First Search</em> (DFS) to construct a topological ordering.
- *
* @param res the ordered list that we are building
* @param root the current node we are visiting
* @param permanents the nodes that have been successfully been visited
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 dac6300..c3372fe 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
@@ -76,7 +76,6 @@ public final class FileUtil {
/**
* Converts a file path to one that is compatible with the host operating system.
- *
* @param path The file path to convert.
* @return The converted file path.
*/
@@ -100,7 +99,6 @@ public final class FileUtil {
/**
* Writes a file from a string with a specified encoding.
- *
* @param path
* @param name
* @param encoding
@@ -276,7 +274,6 @@ public final class FileUtil {
/**
* Search for the specified <code>searchString</code> in the given
* {@link Reader}.
- *
* @param reader A Reader in which the String will be searched.
* @param searchString The String to search for
* @return <code>TRUE</code> if the <code>searchString</code> is found;
@@ -306,7 +303,6 @@ public final class FileUtil {
* Search for the specified <code>searchString</code> in the given
* filename. If the specified file doesn't exist, <code>FALSE</code>
* returns.
- *
* @param fileName A full path to a file in which the String will be searched.
* @param searchString The String to search for
* @return <code>TRUE</code> if the <code>searchString</code> is found;
@@ -326,7 +322,6 @@ public final class FileUtil {
/**
* Check if the specified <code>fileName</code> exists and is a file (not a directory)
* If the specified file doesn't exist or is a directory <code>FALSE</code> returns.
- *
* @param fileName A full path to a file in which the String will be searched.
* @return <code>TRUE</code> if the <code>fileName</code> exists and is a file (not a directory)
* <code>FALSE</code> otherwise.
@@ -339,7 +334,6 @@ public final class FileUtil {
/**
* For an inputStream and a file name, create a zip stream containing only one entry with the inputStream set to fileName
* If fileName is empty, generate a unique one.
- *
* @param fileStream
* @param fileName
* @return zipStream
@@ -377,7 +371,6 @@ public final class FileUtil {
/**
* Unzip file structure of the given zipFile to specified outputFolder
- *
* @param zipFile
* @param outputFolder
* @throws IOException
@@ -420,7 +413,6 @@ public final class FileUtil {
* Creates a File with a normalized file path
* This useful to prevent path traversal security issues
* cf. OFBIZ-9973 for more details
- *
* @param filePath The file path to normalize
* @return A File with a normalized file path
*/
@@ -431,7 +423,6 @@ public final class FileUtil {
/**
* Normalizes a file path
* This useful to prevent path traversal security issues
- *
* @param filePath The file path to normalize
* @return A normalized file path
*/
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java
index 9007b48..3e8f6e6 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java
@@ -105,7 +105,6 @@ public final class GroovyUtil {
* back to the caller. Any variables that are created in the script
* are lost when the script ends unless they are copied to the
* "context" <code>Map</code>.</p>
- *
* @param context A <code>Map</code> containing initial variables
* @return A <code>Binding</code> instance
*/
@@ -171,7 +170,6 @@ public final class GroovyUtil {
* <p>
* This method is useful for parsing a Groovy script referenced by
* a flexible location like {@code component://myComponent/script.groovy}.
- *
* @param in the input stream containing the class source code
* @param location the file name to associate with this class
* @return the corresponding class object
@@ -200,7 +198,6 @@ public final class GroovyUtil {
* Runs a Groovy script with a context argument.
* <p>
* A Groovy script can be either a stand-alone script or a method embedded in a script.
- *
* @param location the location of the script file
* @param methodName the name of the method inside the script to be run,
* if it is {@code null} consider the script as stand-alone
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpRequestFileUpload.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpRequestFileUpload.java
index 8be2dfe..239cdd1 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpRequestFileUpload.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpRequestFileUpload.java
@@ -38,9 +38,9 @@ import javax.servlet.http.HttpServletRequest;
*/
public class HttpRequestFileUpload {
private static final String MODULE = HttpRequestFileUpload.class.getName();
- private int BUFFER_SIZE = 4096;
- private int WAIT_INTERVAL = 200; // in milliseconds
- private int MAX_WAITS = 20;
+ private static final int BUFFER_SIZE = 4096;
+ private static final int WAIT_INTERVAL = 200; // in milliseconds
+ private static final int MAX_WAITS = 20;
private int waitCount = 0;
private String savePath;
private String filepath;
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/JNDIContextFactory.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/JNDIContextFactory.java
index a6cdb05..862a32a 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/JNDIContextFactory.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/JNDIContextFactory.java
@@ -35,39 +35,40 @@ public class JNDIContextFactory {
private static final String MODULE = JNDIContextFactory.class.getName();
// FIXME: InitialContext instances are not thread-safe! They should not be cached.
- private static final UtilCache<String, InitialContext> contexts = UtilCache.createUtilCache("entity.JNDIContexts", 0, 0);
+ private static final UtilCache<String, InitialContext> CONTEXTS = UtilCache.createUtilCache("entity.JNDIContexts", 0, 0);
/**
* Return the initial context according to the entityengine.xml parameters that correspond to the given prefix
* @return the JNDI initial context
*/
public static InitialContext getInitialContext(String jndiServerName) throws GenericConfigException {
- InitialContext ic = contexts.get(jndiServerName);
+ InitialContext ic = CONTEXTS.get(jndiServerName);
if (ic == null) {
JNDIConfigUtil.JndiServerInfo jndiServerInfo = JNDIConfigUtil.getJndiServerInfo(jndiServerName);
if (jndiServerInfo == null) {
- throw new GenericConfigException("ERROR: no jndi-server definition was found with the name " + jndiServerName + " in jndiservers.xml");
+ throw new GenericConfigException("ERROR: no jndi-server definition was found with the name " + jndiServerName
+ + " in jndiservers.xml");
}
try {
- if (UtilValidate.isEmpty(jndiServerInfo.contextProviderUrl)) {
+ if (UtilValidate.isEmpty(jndiServerInfo.getContextProviderUrl())) {
ic = new InitialContext();
} else {
Hashtable<String, Object> h = new Hashtable<>();
- h.put(Context.INITIAL_CONTEXT_FACTORY, jndiServerInfo.initialContextFactory);
- h.put(Context.PROVIDER_URL, jndiServerInfo.contextProviderUrl);
- if (UtilValidate.isNotEmpty(jndiServerInfo.urlPkgPrefixes)) {
- h.put(Context.URL_PKG_PREFIXES, jndiServerInfo.urlPkgPrefixes);
+ h.put(Context.INITIAL_CONTEXT_FACTORY, jndiServerInfo.getInitialContextFactory());
+ h.put(Context.PROVIDER_URL, jndiServerInfo.getContextProviderUrl());
+ if (UtilValidate.isNotEmpty(jndiServerInfo.getUrlPkgPrefixes())) {
+ h.put(Context.URL_PKG_PREFIXES, jndiServerInfo.getUrlPkgPrefixes());
}
- if (UtilValidate.isNotEmpty(jndiServerInfo.securityPrincipal)) {
- h.put(Context.SECURITY_PRINCIPAL, jndiServerInfo.securityPrincipal);
+ if (UtilValidate.isNotEmpty(jndiServerInfo.getSecurityPrincipal())) {
+ h.put(Context.SECURITY_PRINCIPAL, jndiServerInfo.getSecurityPrincipal());
}
- if (UtilValidate.isNotEmpty(jndiServerInfo.securityCredentials)) {
- h.put(Context.SECURITY_CREDENTIALS, jndiServerInfo.securityCredentials);
+ if (UtilValidate.isNotEmpty(jndiServerInfo.getSecurityCredentials())) {
+ h.put(Context.SECURITY_CREDENTIALS, jndiServerInfo.getSecurityCredentials());
}
ic = new InitialContext(h);
@@ -79,7 +80,7 @@ public class JNDIContextFactory {
throw new GenericConfigException(errorMsg, e);
}
- ic = contexts.putIfAbsentAndGet(jndiServerName, ic);
+ ic = CONTEXTS.putIfAbsentAndGet(jndiServerName, ic);
}
return ic;
@@ -89,6 +90,6 @@ public class JNDIContextFactory {
* @param jndiServerName
*/
public static void clearInitialContext(String jndiServerName) {
- contexts.remove(jndiServerName);
+ CONTEXTS.remove(jndiServerName);
}
}
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java
index 5a05fee..62078de 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java
@@ -48,43 +48,43 @@ public class ObjectType {
public static final String LANG_PACKAGE = "java.lang."; // We will test both the raw value and this + raw value
public static final String SQL_PACKAGE = "java.sql."; // We will test both the raw value and this + raw value
- private static final Map<String, String> classAlias = new HashMap<>();
- private static final Map<String, Class<?>> primitives = new HashMap<>();
+ private static final Map<String, String> CLASS_ALIAS = new HashMap<>();
+ private static final Map<String, Class<?>> PRIMITIVES = new HashMap<>();
static {
- classAlias.put("Object", "java.lang.Object");
- classAlias.put("String", "java.lang.String");
- classAlias.put("Boolean", "java.lang.Boolean");
- classAlias.put("BigDecimal", "java.math.BigDecimal");
- classAlias.put("Double", "java.lang.Double");
- classAlias.put("Float", "java.lang.Float");
- classAlias.put("Long", "java.lang.Long");
- classAlias.put("Integer", "java.lang.Integer");
- classAlias.put("Short", "java.lang.Short");
- classAlias.put("Byte", "java.lang.Byte");
- classAlias.put("Character", "java.lang.Character");
- classAlias.put("Timestamp", "java.sql.Timestamp");
- classAlias.put("Time", "java.sql.Time");
- classAlias.put("Date", "java.sql.Date");
- classAlias.put("Locale", "java.util.Locale");
- classAlias.put("Collection", "java.util.Collection");
- classAlias.put("List", "java.util.List");
- classAlias.put("Set", "java.util.Set");
- classAlias.put("Map", "java.util.Map");
- classAlias.put("HashMap", "java.util.HashMap");
- classAlias.put("TimeZone", "java.util.TimeZone");
- classAlias.put("TimeDuration", "org.apache.ofbiz.base.util.TimeDuration");
- classAlias.put("GenericValue", "org.apache.ofbiz.entity.GenericValue");
- classAlias.put("GenericPK", "org.apache.ofbiz.entity.GenericPK");
- classAlias.put("GenericEntity", "org.apache.ofbiz.entity.GenericEntity");
- primitives.put("boolean", Boolean.TYPE);
- primitives.put("short", Short.TYPE);
- primitives.put("int", Integer.TYPE);
- primitives.put("long", Long.TYPE);
- primitives.put("float", Float.TYPE);
- primitives.put("double", Double.TYPE);
- primitives.put("byte", Byte.TYPE);
- primitives.put("char", Character.TYPE);
+ CLASS_ALIAS.put("Object", "java.lang.Object");
+ CLASS_ALIAS.put("String", "java.lang.String");
+ CLASS_ALIAS.put("Boolean", "java.lang.Boolean");
+ CLASS_ALIAS.put("BigDecimal", "java.math.BigDecimal");
+ CLASS_ALIAS.put("Double", "java.lang.Double");
+ CLASS_ALIAS.put("Float", "java.lang.Float");
+ CLASS_ALIAS.put("Long", "java.lang.Long");
+ CLASS_ALIAS.put("Integer", "java.lang.Integer");
+ CLASS_ALIAS.put("Short", "java.lang.Short");
+ CLASS_ALIAS.put("Byte", "java.lang.Byte");
+ CLASS_ALIAS.put("Character", "java.lang.Character");
+ CLASS_ALIAS.put("Timestamp", "java.sql.Timestamp");
+ CLASS_ALIAS.put("Time", "java.sql.Time");
+ CLASS_ALIAS.put("Date", "java.sql.Date");
+ CLASS_ALIAS.put("Locale", "java.util.Locale");
+ CLASS_ALIAS.put("Collection", "java.util.Collection");
+ CLASS_ALIAS.put("List", "java.util.List");
+ CLASS_ALIAS.put("Set", "java.util.Set");
+ CLASS_ALIAS.put("Map", "java.util.Map");
+ CLASS_ALIAS.put("HashMap", "java.util.HashMap");
+ CLASS_ALIAS.put("TimeZone", "java.util.TimeZone");
+ CLASS_ALIAS.put("TimeDuration", "org.apache.ofbiz.base.util.TimeDuration");
+ CLASS_ALIAS.put("GenericValue", "org.apache.ofbiz.entity.GenericValue");
+ CLASS_ALIAS.put("GenericPK", "org.apache.ofbiz.entity.GenericPK");
+ CLASS_ALIAS.put("GenericEntity", "org.apache.ofbiz.entity.GenericEntity");
+ PRIMITIVES.put("boolean", Boolean.TYPE);
+ PRIMITIVES.put("short", Short.TYPE);
+ PRIMITIVES.put("int", Integer.TYPE);
+ PRIMITIVES.put("long", Long.TYPE);
+ PRIMITIVES.put("float", Float.TYPE);
+ PRIMITIVES.put("double", Double.TYPE);
+ PRIMITIVES.put("byte", Byte.TYPE);
+ PRIMITIVES.put("char", Character.TYPE);
}
/**
@@ -106,9 +106,9 @@ public class ObjectType {
*/
public static Class<?> loadClass(String className, ClassLoader loader) throws ClassNotFoundException {
Class<?> theClass = null;
- // if it is a primitive type, return the object from the "primitives" map
- if (primitives.containsKey(className)) {
- return primitives.get(className);
+ // if it is a primitive type, return the object from the "PRIMITIVES" map
+ if (PRIMITIVES.containsKey(className)) {
+ return PRIMITIVES.get(className);
}
int genericsStart = className.indexOf("<");
@@ -134,8 +134,8 @@ public class ObjectType {
}
// if className is an alias (e.g. "String") then replace it with the proper class name (e.g. "java.lang.String")
- if (classAlias.containsKey(className)) {
- className = classAlias.get(className);
+ if (CLASS_ALIAS.containsKey(className)) {
+ className = CLASS_ALIAS.get(className);
}
if (loader == null) {
@@ -260,7 +260,7 @@ public class ObjectType {
* Initially created for only simple types but actually handle more types and not all simple types.
* See ObjectTypeTests class for more, and (normally) up to date information
* Supported types:
- * - All primitives
+ * - All PRIMITIVES
* - Simple types: String, Boolean, Double, Float, Long, Integer, BigDecimal.
* - Other Objects: List, Map, Set, Calendar, Date (java.sql.Date), Time, Timestamp, TimeZone, Date (util.Date and sql.Date)
* - Simple types (maybe) not handled: Short, BigInteger, Byte, Character, ObjectName and Void...
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/Observable.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/Observable.java
index 953b31a..f766feb 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/Observable.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/Observable.java
@@ -47,7 +47,6 @@ public final class Observable {
/**
* Adds an observer to the set of observers for this object.
- *
* @param observer the observer to be added.
*/
public void addObserver(Observer observer) {
@@ -65,7 +64,6 @@ public final class Observable {
/**
* Deletes an observer from the set of observers of this object.
* Passing <code>null</code> to this method will have no effect.
- *
* @param observer the observer to be deleted.
*/
public void deleteObserver(Observer observer) {
@@ -81,7 +79,6 @@ public final class Observable {
/**
* Returns <code>true</code> if this object has changed.
- *
*/
public boolean hasChanged() {
return changed.get();
@@ -96,7 +93,6 @@ public final class Observable {
* <blockquote>
* {@code notifyObservers(null)}
* </blockquote>
- *
*/
public void notifyObservers() {
notifyObservers(null);
@@ -106,7 +102,6 @@ public final class Observable {
* Notify all of the observers.
* <p>Each observer has its <code>update</code> method called with two
* arguments: this observable object and the <code>arg</code> argument.</p>
- *
*/
public void notifyObservers(Object arg) {
for (Observer observer : observers) {
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/Observer.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/Observer.java
index f3301e0..db7b151 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/Observer.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/Observer.java
@@ -25,7 +25,6 @@ package org.apache.ofbiz.base.util;
public interface Observer {
/**
* Called when <code>Observable.notifyObservers</code> is invoked.
- *
* @param observable
* @param arg
*/
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/PatternFactory.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/PatternFactory.java
index e6e8831..9d52d5b 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/PatternFactory.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/PatternFactory.java
@@ -30,7 +30,8 @@ import org.apache.oro.text.regex.Perl5Compiler;
public class PatternFactory {
private static final String MODULE = PatternFactory.class.getName();
- private static final UtilCache<String, Pattern> compiledPerl5Patterns = UtilCache.createUtilCache("regularExpression.compiledPerl5Patterns", false);
+ private static final UtilCache<String, Pattern> COMPILED_PERL5_PATTERNS = UtilCache.createUtilCache("regularExpression.compiledPerl5Patterns",
+ false);
/**
* Compiles and caches a Perl5 regexp pattern for the given string pattern.
@@ -42,7 +43,7 @@ public class PatternFactory {
*/
public static Pattern createOrGetPerl5CompiledPattern(String stringPattern, boolean caseSensitive) throws MalformedPatternException {
- Pattern pattern = compiledPerl5Patterns.get(stringPattern);
+ Pattern pattern = COMPILED_PERL5_PATTERNS.get(stringPattern);
if (pattern == null) {
Perl5Compiler compiler = new Perl5Compiler();
if (caseSensitive) {
@@ -50,7 +51,7 @@ public class PatternFactory {
} else {
pattern = compiler.compile(stringPattern, Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK);
}
- pattern = compiledPerl5Patterns.putIfAbsentAndGet(stringPattern, pattern);
+ pattern = COMPILED_PERL5_PATTERNS.putIfAbsentAndGet(stringPattern, pattern);
if (Debug.verboseOn()) {
Debug.logVerbose("Compiled and cached the pattern: '" + stringPattern, MODULE);
}
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/RMIExtendedSocketFactory.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/RMIExtendedSocketFactory.java
index abc9d8c..6767f59 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/RMIExtendedSocketFactory.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/RMIExtendedSocketFactory.java
@@ -46,7 +46,6 @@ public class RMIExtendedSocketFactory extends RMISocketFactory {
/**
* Creates a new <code>RMIExtendedSocketFactory</code> which will create <code>ServerSocket</code>s
* bound on the specified network interface.
- *
* @param inetAddress The <code>InetAddress</code> of the network interface.
*/
public RMIExtendedSocketFactory(InetAddress inetAddress) {
@@ -56,7 +55,6 @@ public class RMIExtendedSocketFactory extends RMISocketFactory {
/**
* Creates a new <code>RMIExtendedSocketFactory</code> which will create <code>ServerSocket</code>s
* bound on the specified network interface.
- *
* @param hostIpAddress The IP address of the interface to bind the server sockets to.
* @throws UnknownHostException If an invalid IP address is provided.
*/
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/SafeObjectInputStream.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/SafeObjectInputStream.java
index d50cfbf..84c8050 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/SafeObjectInputStream.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/SafeObjectInputStream.java
@@ -47,7 +47,6 @@ public final class SafeObjectInputStream extends ObjectInputStream {
/**
* Instantiates a safe object input stream.
- *
* @param in the input stream to read
* @throws IOException when reading is not possible.
*/
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptHelper.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptHelper.java
index 22ebdf6..bd2cb33 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptHelper.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptHelper.java
@@ -37,7 +37,6 @@ public interface ScriptHelper {
/**
* Extracts service IN parameters from <code>inputMap</code> and returns them in a new <code>Map</code>.
- *
* @param serviceName
* @param inputMap
* @return The matching service parameters
@@ -47,14 +46,12 @@ public interface ScriptHelper {
/**
* Sets the event/service status to error status.
- *
* @param message
*/
void error(String message);
/**
* Evaluates a <code>String</code> and returns the result.
- *
* @param original
* @return
*/
@@ -62,7 +59,6 @@ public interface ScriptHelper {
/**
* Sets the event/service status to failure status.
- *
* @param message
*/
void failure(String message);
@@ -97,21 +93,18 @@ public interface ScriptHelper {
/**
* Logs an error message.
- *
* @param message
*/
void logError(String message);
/**
* Logs an info message.
- *
* @param message
*/
void logInfo(String message);
/**
* Logs a warning message.
- *
* @param message
*/
void logWarning(String message);
@@ -126,7 +119,6 @@ public interface ScriptHelper {
/**
* Creates a new, empty <code>GenericValue</code>.
- *
* @param entityName
* @param fields
* @return
@@ -136,7 +128,6 @@ public interface ScriptHelper {
/**
* Runs a service synchronously.
- *
* @param serviceName
* @param inputMap
* @return
@@ -146,7 +137,6 @@ public interface ScriptHelper {
/**
* Runs a service synchronously.
- *
* @param serviceName
* @param inputMap
* @param args
@@ -162,7 +152,6 @@ public interface ScriptHelper {
/**
* Sets the event/service status to success status.
- *
* @param message
*/
void success(String message);
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 8141565..66da395 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
@@ -107,7 +107,6 @@ public final class ScriptUtil {
/**
* Returns a compiled script.
- *
* @param filePath Script path and file name.
* @return The compiled script, or <code>null</code> if the script engine does not support compilation.
* @throws IllegalArgumentException
@@ -145,7 +144,6 @@ public final class ScriptUtil {
/**
* Returns a compiled script.
- *
* @param language
* @param script
* @return The compiled script, or <code>null</code> if the script engine does not support compilation.
@@ -185,7 +183,6 @@ public final class ScriptUtil {
* <p>If a <code>CompiledScript</code> instance is to be shared by multiple threads, then
* each thread must create its own <code>ScriptContext</code> and pass it to the
* <code>CompiledScript</code> eval method.</p>
- *
* @param context
* @return
*/
@@ -207,7 +204,6 @@ public final class ScriptUtil {
* <p>If a <code>CompiledScript</code> instance is to be shared by multiple threads, then
* each thread must create its own <code>ScriptContext</code> and pass it to the
* <code>CompiledScript</code> eval method.</p>
- *
* @param context
* @param protectedKeys
* @return
@@ -226,7 +222,6 @@ public final class ScriptUtil {
/**
* Executes a script <code>String</code> and returns the result.
- *
* @param language
* @param script
* @param scriptClass
@@ -263,7 +258,6 @@ public final class ScriptUtil {
/**
* Executes a compiled script and returns the result.
- *
* @param script Compiled script.
* @param functionName Optional function or method to invoke.
* @param scriptContext Script execution context.
@@ -291,7 +285,6 @@ public final class ScriptUtil {
/**
* Executes the script at the specified location and returns the result.
- *
* @param filePath Script path and file name.
* @param functionName Optional function or method to invoke.
* @param context Script execution context.
@@ -304,7 +297,6 @@ public final class ScriptUtil {
/**
* Executes the script at the specified location and returns the result.
- *
* @param filePath Script path and file name.
* @param functionName Optional function or method to invoke.
* @param context Script execution context.
@@ -329,7 +321,6 @@ public final class ScriptUtil {
/**
* Executes the script at the specified location and returns the result.
- *
* @param filePath Script path and file name.
* @param functionName Optional function or method to invoke.
* @param scriptContext Script execution context.
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/Scriptlet.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/Scriptlet.java
index 032e58b..b88fd5b 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/Scriptlet.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/Scriptlet.java
@@ -44,7 +44,6 @@ public final class Scriptlet {
/**
* Executes the scriptlet and returns the result.
- *
* @param context The script bindings
* @return The scriptlet result
* @throws Exception
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java
index 60d2f67..9c490a7 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java
@@ -44,7 +44,7 @@ public class StringUtil {
public static final StringUtil INSTANCE = new StringUtil();
private static final String MODULE = StringUtil.class.getName();
- private static final Map<String, Pattern> substitutionPatternMap = createSubstitutionPatternMap();
+ private static final Map<String, Pattern> SUBSTITUTION_PATTERN_MAP = createSubstitutionPatternMap();
private static Map<String, Pattern> createSubstitutionPatternMap() {
Map<String, Pattern> substitutionPatternMap = new LinkedHashMap<>(); // Preserve insertion order
@@ -99,7 +99,6 @@ public class StringUtil {
/**
* Creates a single string from a Collection of strings separated by a delimiter.
- *
* @param col a collection of strings to join
* @param delim the delimiter character(s) to use. (null value will join with no delimiter)
* @return a String of all values in the collection separated by the delimiter
@@ -214,7 +213,6 @@ public class StringUtil {
/**
* Reads a String version of a List (should contain only strings) and creates a new List
- *
* @param s String value of a Map ({n1=v1, n2=v2})
* @return new List
*/
@@ -235,7 +233,6 @@ public class StringUtil {
/**
* Reads a String version of a Set (should contain only strings) and creates a new Set
- *
* @param s String value of a Map ({n1=v1, n2=v2})
* @return new List
*/
@@ -346,7 +343,6 @@ public class StringUtil {
/**
* Add the number to the string, keeping (padding to min of original length)
- *
* @return the new value
*/
public static String addToNumberString(String numberString, long addAmount) {
@@ -385,7 +381,7 @@ public class StringUtil {
public static String convertOperatorSubstitutions(String expression) {
String result = expression;
if (result != null && (result.contains("@"))) {
- for (Map.Entry<String, Pattern> entry: substitutionPatternMap.entrySet()) {
+ for (Map.Entry<String, Pattern> entry: SUBSTITUTION_PATTERN_MAP.entrySet()) {
Pattern pattern = entry.getValue();
result = pattern.matcher(result).replaceAll(entry.getKey());
}
@@ -416,7 +412,7 @@ public class StringUtil {
public static class StringWrapper {
public static final StringWrapper EMPTY_STRING_WRAPPER = new StringWrapper("");
- protected String theString;
+ private String theString;
protected StringWrapper() { }
public StringWrapper(String theString) {
this.theString = theString;
@@ -424,7 +420,6 @@ public class StringUtil {
/**
* Fairly simple method used for the plus (+) base concatenation in Groovy.
- *
* @param value
* @return the wrapped string, plus the value
*/
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/TimeDuration.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/TimeDuration.java
index 97bb963..dd40dce 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/TimeDuration.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/TimeDuration.java
@@ -33,15 +33,15 @@ import com.ibm.icu.util.Calendar;
public class TimeDuration implements Serializable, Comparable<TimeDuration> {
/** A <code>TimeDuration</code> instance that represents a zero time duration. */
private static final String MODULE = TimeDuration.class.getName();
- public static final TimeDuration ZeroTimeDuration = new NullDuration();
+ public static final TimeDuration ZERO_TIME_DURATION = new NullDuration();
- protected final int milliseconds;
- protected final int seconds;
- protected final int minutes;
- protected final int hours;
- protected final int days;
- protected final int months;
- protected final int years;
+ private final int milliseconds;
+ private final int seconds;
+ private final int minutes;
+ private final int hours;
+ private final int days;
+ private final int months;
+ private final int years;
/**
* @param years The number of years in this duration
@@ -233,7 +233,6 @@ public class TimeDuration implements Serializable, Comparable<TimeDuration> {
}
/** Returns <code>true</code> if this duration is negative.
- *
* @return <code>true</code> if this duration is negative
*/
public boolean isNegative() {
@@ -241,7 +240,6 @@ public class TimeDuration implements Serializable, Comparable<TimeDuration> {
}
/** Returns <code>true</code> if this duration is zero.
- *
* @return <code>true</code> if this duration is zero
*/
public boolean isZero() {
@@ -311,13 +309,12 @@ public class TimeDuration implements Serializable, Comparable<TimeDuration> {
* <code>toLong</code> method. <b>Note:</b> this
* method should not be used to calculate elapsed time - use the elapsed
* time constructor instead.
- *
* @param duration An encoded duration
* @return A <code>TimeDuration</code> instance
*/
public static TimeDuration fromLong(long duration) {
if (duration == 0) {
- return ZeroTimeDuration;
+ return ZERO_TIME_DURATION;
}
long units = duration / 0x757B12C00L;
int years = (int) units;
@@ -346,17 +343,16 @@ public class TimeDuration implements Serializable, Comparable<TimeDuration> {
* intended to be used with entity engine fields. Some duration fields are
* stored as a <code>Long</code>, while others are stored as a
* <code>Double</code>. This method will decode both types.</p>
- *
* @param number A <code>Number</code> instance, can be <code>null</code>
* @return A <code>TimeDuration</code> instance
*/
public static TimeDuration fromNumber(Number number) {
- return number == null ? ZeroTimeDuration : fromLong(number.longValue());
+ return number == null ? ZERO_TIME_DURATION : fromLong(number.longValue());
}
public static TimeDuration parseDuration(String duration) {
if (UtilValidate.isEmpty(duration)) {
- return ZeroTimeDuration;
+ return ZERO_TIME_DURATION;
}
boolean isZero = true;
int[] intArray = {0, 0, 0, 0, 0, 0, 0};
@@ -372,7 +368,7 @@ public class TimeDuration implements Serializable, Comparable<TimeDuration> {
i--;
}
if (isZero) {
- return ZeroTimeDuration;
+ return ZERO_TIME_DURATION;
}
return new TimeDuration(intArray[0], intArray[1], intArray[2],
intArray[3], intArray[4], intArray[5], intArray[6]);
@@ -381,7 +377,6 @@ public class TimeDuration implements Serializable, Comparable<TimeDuration> {
/** Returns a <code>long</code> value derived from a <code>TimeDuration</code>
* instance. This method is intended to be used in tandem with the
* <code>fromLong</code> method.
- *
* @param duration
* @return the duration encoded as a <code>long</code> value
*/
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 4a99b8e..394595a 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
@@ -47,13 +47,13 @@ import org.owasp.html.Sanitizers;
@SuppressWarnings("rawtypes")
public class UtilCodec {
private static final String MODULE = UtilCodec.class.getName();
- private static final HtmlEncoder htmlEncoder = new HtmlEncoder();
- private static final XmlEncoder xmlEncoder = new XmlEncoder();
- private static final StringEncoder stringEncoder = new StringEncoder();
- private static final UrlCodec urlCodec = new UrlCodec();
- private static final List<Codec> codecs;
+ private static final HtmlEncoder HTML_ENCODER = new HtmlEncoder();
+ private static final XmlEncoder XML_ENCODER = new XmlEncoder();
+ private static final StringEncoder STRING_ENCODER = new StringEncoder();
+ private static final UrlCodec URL_CODEC = new UrlCodec();
+ private static final List<Codec> CODECS;
// From https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#Event_Handlers
- private static final List<String> jsEventList = Arrays.asList(new String[] {"onAbort", "onActivate",
+ private static final List<String> JS_EVENT_LIST = Arrays.asList(new String[] {"onAbort", "onActivate",
"onAfterPrint", "onAfterUpdate", "onBeforeActivate", "onBeforeCopy", "onBeforeCut", "onBeforeDeactivate",
"onBeforeEditFocus", "onBeforePaste", "onBeforePrint", "onBeforeUnload", "onBeforeUpdate", "onBegin",
"onBlur", "onBounce", "onCellChange", "onChange", "onClick", "onContextMenu", "onControlSelect", "onCopy",
@@ -74,7 +74,7 @@ public class UtilCodec {
List<Codec> tmpCodecs = new ArrayList<>();
tmpCodecs.add(new HTMLEntityCodec());
tmpCodecs.add(new PercentCodec());
- codecs = Collections.unmodifiableList(tmpCodecs);
+ CODECS = Collections.unmodifiableList(tmpCodecs);
}
@SuppressWarnings("serial")
@@ -124,7 +124,6 @@ public class UtilCodec {
* "sanitizer.permissive.policy" and "sanitizer.custom.permissive.policy.class".
* The custom policy has to implement
* {@link org.apache.ofbiz.base.html.SanitizerCustomPolicy}.
- *
* @param original
* @param contentTypeId
* @return sanitized HTML-Code if enabled, original HTML-Code when disabled
@@ -294,13 +293,13 @@ public class UtilCodec {
public static SimpleEncoder getEncoder(String type) {
if ("url".equals(type)) {
- return urlCodec;
+ return URL_CODEC;
} else if ("xml".equals(type)) {
- return xmlEncoder;
+ return XML_ENCODER;
} else if ("html".equals(type)) {
- return htmlEncoder;
+ return HTML_ENCODER;
} else if ("string".equals(type)) {
- return stringEncoder;
+ return STRING_ENCODER;
} else {
return null;
}
@@ -308,7 +307,7 @@ public class UtilCodec {
public static SimpleDecoder getDecoder(String type) {
if ("url".equals(type)) {
- return urlCodec;
+ return URL_CODEC;
}
return null;
}
@@ -335,7 +334,7 @@ public class UtilCodec {
clean = true;
// try each codec and keep track of which ones work
- Iterator<Codec> i = codecs.iterator();
+ Iterator<Codec> i = CODECS.iterator();
while (i.hasNext()) {
Codec codec = i.next();
String old = working;
@@ -378,7 +377,6 @@ public class UtilCodec {
* Does not allow various characters (after canonicalization), including
* "<", ">", "&" and "%" (if not followed by a space).
* Also does not allow js events as in OFBIZ-10054
- *
* @param valueName field name checked
* @param value value checked
* @param errorMessageList an empty list passed by and modified in case of issues
@@ -423,7 +421,7 @@ public class UtilCodec {
// check for js events
String onEvent = "on" + StringUtils.substringBetween(value, " on", "=");
- if (jsEventList.stream().anyMatch(str -> StringUtils.containsIgnoreCase(str, onEvent))
+ if (JS_EVENT_LIST.stream().anyMatch(str -> StringUtils.containsIgnoreCase(str, onEvent))
|| value.contains("seekSegmentTime")) {
String issueMsg = null;
if (locale.equals(new Locale("test"))) {
@@ -451,7 +449,6 @@ public class UtilCodec {
* "sanitizer.safe.policy" and "sanitizer.custom.safe.policy.class".
* The safe policy has to implement
* {@link org.apache.ofbiz.base.html.SanitizerCustomPolicy}.
- *
* @param valueName field name checked
* @param value value checked
* @param errorMessageList an empty list passed by and modified in case of issues
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilDateTime.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilDateTime.java
index 9e36d8d..f58eb28 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilDateTime.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilDateTime.java
@@ -41,7 +41,7 @@ public final class UtilDateTime {
private static final String MODULE = UtilDateTime.class.getName();
- private static final String[][] timevals = {
+ private static final String[][] TIMEVALS = {
{"1000", "millisecond"},
{"60", "second"},
{"60", "minute"},
@@ -49,7 +49,7 @@ public final class UtilDateTime {
{"168", "week"}
};
- private static final DecimalFormat df = new DecimalFormat("0.00;-0.00");
+ private static final DecimalFormat DF = new DecimalFormat("0.00;-0.00");
/**
* JDBC escape format for java.sql.Date conversions.
*/
@@ -114,8 +114,8 @@ public final class UtilDateTime {
}
public static String formatInterval(double interval, int count, Locale locale) {
- List<Double> parts = new ArrayList<>(timevals.length);
- for (String[] timeval: timevals) {
+ List<Double> parts = new ArrayList<>(TIMEVALS.length);
+ for (String[] timeval: TIMEVALS) {
int value = Integer.parseInt(timeval[0]);
double remainder = interval % value;
interval = interval / value;
@@ -126,8 +126,8 @@ public final class UtilDateTime {
StringBuilder sb = new StringBuilder();
for (int i = parts.size() - 1; i >= 0 && count > 0; i--) {
- Double D = parts.get(i);
- double d = D;
+ Double doub = parts.get(i);
+ double d = doub;
if (d < 1) {
continue;
}
@@ -135,13 +135,13 @@ public final class UtilDateTime {
sb.append(", ");
}
count--;
- sb.append(count == 0 ? df.format(d) : Integer.toString(D.intValue()));
+ sb.append(count == 0 ? DF.format(d) : Integer.toString(doub.intValue()));
sb.append(' ');
Object label;
- if (D.intValue() == 1) {
- label = uiDateTimeMap.get(timevals[i][1] + ".singular");
+ if (doub.intValue() == 1) {
+ label = uiDateTimeMap.get(TIMEVALS[i][1] + ".singular");
} else {
- label = uiDateTimeMap.get(timevals[i][1] + ".plural");
+ label = uiDateTimeMap.get(TIMEVALS[i][1] + ".plural");
}
sb.append(label);
}
@@ -150,7 +150,6 @@ public final class UtilDateTime {
/**
* Return a Timestamp for right now
- *
* @return Timestamp for right now
*/
public static java.sql.Timestamp nowTimestamp() {
@@ -177,7 +176,6 @@ public final class UtilDateTime {
/**
* Returns currentTimeMillis as String
- *
* @return String(currentTimeMillis)
*/
public static String nowAsString() {
@@ -186,7 +184,6 @@ public final class UtilDateTime {
/**
* Return a string formatted as yyyyMMddHHmmss
- *
* @return String formatted for right now
*/
public static String nowDateString() {
@@ -195,7 +192,6 @@ public final class UtilDateTime {
/**
* Return a string formatted as format
- *
* @return String formatted for right now
*/
public static String nowDateString(String format) {
@@ -205,7 +201,6 @@ public final class UtilDateTime {
/**
* Return a Date for right now
- *
* @return Date for right now
*/
public static java.util.Date nowDate() {
@@ -234,7 +229,6 @@ public final class UtilDateTime {
/**
* Return the date for the first day of the year
- *
* @param stamp
* @return java.sql.Timestamp
*/
@@ -253,13 +247,12 @@ public final class UtilDateTime {
return getYearStart(stamp, daysLater, monthsLater, yearsLater, TimeZone.getDefault(), Locale.getDefault());
}
public static java.sql.Timestamp getYearStart(java.sql.Timestamp stamp, Number daysLater, Number monthsLater, Number yearsLater) {
- return getYearStart(stamp, (daysLater == null ? 0 : daysLater.intValue()),
- (monthsLater == null ? 0 : monthsLater.intValue()), (yearsLater == null ? 0 : yearsLater.intValue()));
+ return getYearStart(stamp, (daysLater == null ? 0 : daysLater.intValue()), (monthsLater == null ? 0
+ : monthsLater.intValue()), (yearsLater == null ? 0 : yearsLater.intValue()));
}
/**
* Return the date for the first day of the month
- *
* @param stamp
* @return java.sql.Timestamp
*/
@@ -277,7 +270,6 @@ public final class UtilDateTime {
/**
* Return the date for the first day of the week
- *
* @param stamp
* @return java.sql.Timestamp
*/
@@ -307,7 +299,6 @@ public final class UtilDateTime {
/**
* Converts a date String into a java.sql.Date
- *
* @param date The date String: MM/DD/YYYY
* @return A java.sql.Date made from the date String
*/
@@ -322,7 +313,6 @@ public final class UtilDateTime {
/**
* Makes a java.sql.Date from separate Strings for month, day, year
- *
* @param monthStr The month String
* @param dayStr The day String
* @param yearStr The year String
@@ -339,7 +329,6 @@ public final class UtilDateTime {
/**
* Makes a java.sql.Date from separate ints for month, day, year
- *
* @param month The month int
* @param day The day int
* @param year The year int
@@ -356,7 +345,6 @@ public final class UtilDateTime {
/**
* Converts a time String into a java.sql.Time
- *
* @param time The time String: either HH:MM or HH:MM:SS
* @return A java.sql.Time made from the time String
*/
@@ -371,7 +359,6 @@ public final class UtilDateTime {
/**
* Makes a java.sql.Time from separate Strings for hour, minute, and second.
- *
* @param hourStr The hour String
* @param minuteStr The minute String
* @param secondStr The second String
@@ -388,7 +375,6 @@ public final class UtilDateTime {
/**
* Makes a java.sql.Time from separate ints for hour, minute, and second.
- *
* @param hour The hour int
* @param minute The minute int
* @param second The second int
@@ -405,7 +391,6 @@ public final class UtilDateTime {
/**
* Converts a date and time String into a Timestamp
- *
* @param dateTime A combined data and time string in the format "MM/DD/YYYY HH:MM:SS", the seconds are optional
* @return The corresponding Timestamp
*/
@@ -420,7 +405,6 @@ public final class UtilDateTime {
/**
* Converts a date String and a time String into a Timestamp
- *
* @param date The date String: MM/DD/YYYY
* @param time The time String: either HH:MM or HH:MM:SS
* @return A Timestamp made from the date and time Strings
@@ -436,7 +420,6 @@ public final class UtilDateTime {
/**
* Makes a Timestamp from separate Strings for month, day, year, hour, minute, and second.
- *
* @param monthStr The month String
* @param dayStr The day String
* @param yearStr The year String
@@ -457,7 +440,6 @@ public final class UtilDateTime {
/**
* Makes a Timestamp from separate ints for month, day, year, hour, minute, and second.
- *
* @param month The month int
* @param day The day int
* @param year The year int
@@ -484,7 +466,6 @@ public final class UtilDateTime {
/**
* Converts a date and time String into a Date
- *
* @param dateTime A combined data and time string in the format "MM/DD/YYYY HH:MM:SS", the seconds are optional
* @return The corresponding Date
*/
@@ -501,7 +482,6 @@ public final class UtilDateTime {
/**
* Converts a date String and a time String into a Date
- *
* @param date The date String: MM/DD/YYYY
* @param time The time String: either HH:MM or HH:MM:SS
* @return A Date made from the date and time Strings
@@ -547,7 +527,6 @@ public final class UtilDateTime {
/**
* Makes a Date from separate Strings for month, day, year, hour, minute, and second.
- *
* @param monthStr The month String
* @param dayStr The day String
* @param yearStr The year String
@@ -577,7 +556,6 @@ public final class UtilDateTime {
/**
* Makes a Date from separate ints for month, day, year, hour, minute, and second.
- *
* @param month The month int
* @param day The day int
* @param year The year int
@@ -600,7 +578,6 @@ public final class UtilDateTime {
/**
* Makes a date String in the given from a Date
- *
* @param date The Date
* @return A date String in the given format
*/
@@ -623,7 +600,6 @@ public final class UtilDateTime {
/**
* Makes a date String in the format MM/DD/YYYY from a Date
- *
* @param date The Date
* @return A date String in the format MM/DD/YYYY
*/
@@ -633,7 +609,6 @@ public final class UtilDateTime {
/**
* Makes a time String in the format HH:MM:SS from a Date. If the seconds are 0, then the output is in HH:MM.
- *
* @param date The Date
* @return A time String in the format HH:MM:SS or HH:MM
*/
@@ -649,7 +624,6 @@ public final class UtilDateTime {
/**
* Makes a time String in the format HH:MM:SS from a separate ints for hour, minute, and second. If the seconds are 0, then the output is in HH:MM.
- *
* @param hour The hour int
* @param minute The minute int
* @param second The second int
@@ -683,7 +657,6 @@ public final class UtilDateTime {
/**
* Makes a combined data and time string in the format "MM/DD/YYYY HH:MM:SS" from a Date. If the seconds are 0 they are left off.
- *
* @param date The Date
* @return A combined data and time string in the format "MM/DD/YYYY HH:MM:SS" where the seconds are left off if they are 0.
*/
@@ -709,7 +682,6 @@ public final class UtilDateTime {
/**
* Makes a Timestamp for the beginning of the month
- *
* @return A Timestamp of the beginning of the month
*/
public static java.sql.Timestamp monthBegin() {
@@ -726,7 +698,6 @@ public final class UtilDateTime {
/**
* returns a week number in a year for a Timestamp input
- *
* @param input Timestamp date
* @return A int containing the week number
*/
@@ -736,7 +707,6 @@ public final class UtilDateTime {
/**
* returns a day number in a week for a Timestamp input
- *
* @param stamp Timestamp date
* @return A int containing the day number (sunday = 1, saturday = 7)
*/
@@ -768,7 +738,6 @@ public final class UtilDateTime {
/**
* Returns a Calendar object initialized to the specified date/time, time zone,
* and locale.
- *
* @param date date/time to use
* @param timeZone
* @param locale
@@ -786,7 +755,6 @@ public final class UtilDateTime {
/**
* Perform date/time arithmetic on a Timestamp. This is the only accurate way to
* perform date/time arithmetic across locales and time zones.
- *
* @param stamp date/time to perform arithmetic on
* @param adjType the adjustment type to perform. Use one of the java.util.Calendar fields.
* @param adjQuantity the adjustment quantity.
@@ -942,7 +910,6 @@ public final class UtilDateTime {
/**
* Returns a List of month name Strings - suitable for calendar headings.
- *
* @param locale
* @return List of month name Strings
*/
@@ -960,7 +927,6 @@ public final class UtilDateTime {
/**
* Returns an initialized DateFormat object.
- *
* @param dateFormat
* optional format string
* @param tz
@@ -1048,7 +1014,7 @@ public final class UtilDateTime {
// Private lazy-initializer class
private static class TimeZoneHolder {
- private static final List<TimeZone> availableTimeZoneList = getTimeZones();
+ private static final List<TimeZone> AVAIL_TIME_ZONE_LIST = getTimeZones();
private static List<TimeZone> getTimeZones() {
ArrayList<TimeZone> availableTimeZoneList = new ArrayList<>();
@@ -1073,7 +1039,7 @@ public final class UtilDateTime {
* @see java.util.TimeZone
*/
public static List<TimeZone> availableTimeZones() {
- return TimeZoneHolder.availableTimeZoneList;
+ return TimeZoneHolder.AVAIL_TIME_ZONE_LIST;
}
/** Returns a TimeZone object based upon a time zone ID. Method defaults to
@@ -1171,7 +1137,6 @@ public final class UtilDateTime {
* Returns a copy of {@code date} that cannot be modified.
* Attempts to modify the returned date will result in an
* {@code UnsupportedOperationException}.
- *
* @param date the date to copy
* @return an immutable copy of {@code date}.
*/
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java
index 5f68a18..973c179 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java
@@ -50,7 +50,6 @@ public final class UtilFormatOut {
}
/** Format a number with format type define by properties
- *
*/
public static String formatNumber(Double number, String formatType, Delegator delegator, Locale locale) {
if (number == null) {
@@ -308,7 +307,6 @@ public final class UtilFormatOut {
/** Formats a <code>Date</code> into a date-only <code>String</code> using the specified locale and time zone,
* or using the specified format.
- *
* @param date The date to format
* @param dateTimeFormat Optional format string
* @param locale The format locale - can be <code>null</code> if <code>dateFormat</code> is not <code>null</code>
@@ -322,7 +320,6 @@ public final class UtilFormatOut {
/** Formats a <code>Date</code> into a date-time <code>String</code> using the specified locale and time zone,
* or using the specified format.
- *
* @param date The date to format
* @param dateTimeFormat Optional format string
* @param locale The format locale - can be <code>null</code> if <code>dateFormat</code> is not <code>null</code>
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java
index b09c3ce..0478712 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java
@@ -127,7 +127,6 @@ public final class UtilHttp {
* Creates a canonicalized parameter map from a HTTP request.
* <p>
* If parameters are empty, the multi-part parameter map will be used.
- *
* @param request the HTTP request containing the parameters
* @return a canonicalized parameter map.
*/
@@ -139,7 +138,6 @@ public final class UtilHttp {
* Creates a canonicalized parameter map from a HTTP request.
* <p>
* If parameters are empty, the multi-part parameter map will be used.
- *
* @param req the HTTP request containing the parameters
* @param pred the predicate filtering the parameter names
* @return a canonicalized parameter map.
@@ -169,7 +167,6 @@ public final class UtilHttp {
* Transforms a string array into either a list of string or string.
* <p>
* This is meant to facilitate the work of request handlers.
- *
* @param value the array of string to prepare
* @return the adapted value.
* @throws NullPointerException when {@code value} is {@code null}.
@@ -354,7 +351,6 @@ public final class UtilHttp {
* <p>
* path parameters are denoted by "/~KEY0=VALUE0/~KEY1=VALUE1/".
* This is an obsolete syntax for passing parameters to request handlers.
- *
* @param path the URI path part which can be {@code null}
* @param pred the predicate filtering parameter names
* @return a canonicalized parameter map.
@@ -414,7 +410,6 @@ public final class UtilHttp {
/**
* Create a map from a HttpRequest (attributes) object used in JSON requests
- *
* @return The resulting Map
*/
public static Map<String, Object> getJSONAttributeMap(HttpServletRequest request) {
@@ -439,7 +434,6 @@ public final class UtilHttp {
/**
* Create a map from a HttpRequest (attributes) object
- *
* @return The resulting Map
*/
public static Map<String, Object> getAttributeMap(HttpServletRequest request) {
@@ -448,7 +442,6 @@ public final class UtilHttp {
/**
* Create a map from a HttpRequest (attributes) object
- *
* @return The resulting Map
*/
public static Map<String, Object> getAttributeMap(HttpServletRequest request, Set<? extends String> namesToSkip) {
@@ -476,7 +469,6 @@ public final class UtilHttp {
/**
* Create a map from a HttpSession object
- *
* @return The resulting Map
*/
public static Map<String, Object> getSessionMap(HttpServletRequest request) {
@@ -485,7 +477,6 @@ public final class UtilHttp {
/**
* Create a map from a HttpSession object
- *
* @return The resulting Map
*/
public static Map<String, Object> getSessionMap(HttpServletRequest request, Set<? extends String> namesToSkip) {
@@ -514,7 +505,6 @@ public final class UtilHttp {
/**
* Create a map from a ServletContext object
- *
* @return The resulting Map
*/
public static Map<String, Object> getServletContextMap(HttpServletRequest request) {
@@ -523,7 +513,6 @@ public final class UtilHttp {
/**
* Create a map from a ServletContext object
- *
* @return The resulting Map
*/
public static Map<String, Object> getServletContextMap(HttpServletRequest request, Set<? extends String> namesToSkip) {
@@ -653,7 +642,6 @@ public final class UtilHttp {
/**
* Constructs a list of parameter values whose keys are matching a given prefix and suffix.
- *
* @param request the HTTP request containing the parameters
* @param suffix the suffix that must be matched which can be {@code null}
* @param prefix the prefix that must be matched which can be {@code null}
@@ -666,7 +654,6 @@ public final class UtilHttp {
/**
* Constructs a list of parameter values whose keys are matching a given prefix and suffix.
- *
* @param request the HTTP request containing the parameters
* @param additionalFields the additional parameters
* @param suffix the suffix that must be matched which can be {@code null}
@@ -695,7 +682,6 @@ public final class UtilHttp {
/**
* Given a request, returns the application name or "root" if deployed on root
- *
* @param request An HttpServletRequest to get the name info from
* @return String
*/
@@ -756,7 +742,6 @@ public final class UtilHttp {
/**
* Resolve the method send with the request.
* check first the parameter _method before return the request method
- *
* @param request
* @return method
*/
@@ -796,7 +781,6 @@ public final class UtilHttp {
/**
* Get the Locale object from a session variable; if not found use the browser's default
- *
* @param request HttpServletRequest object to use for lookup
* @return Locale The current Locale to use
*/
@@ -810,7 +794,6 @@ public final class UtilHttp {
/**
* Get the Locale object from a session variable; if not found use the system's default.
* NOTE: This method is not recommended because it ignores the Locale from the browser not having the request object.
- *
* @param session HttpSession object to use for lookup
* @return Locale The current Locale to use
*/
@@ -897,7 +880,6 @@ public final class UtilHttp {
/**
* Return the VisualTheme object from the user session
- *
* @param request
* @return
*/
@@ -915,7 +897,6 @@ public final class UtilHttp {
/**
* Get the currency string from the session.
- *
* @param session HttpSession object to use for lookup
* @return String The ISO currency code
*/
@@ -961,7 +942,6 @@ public final class UtilHttp {
/**
* Get the currency string from the session.
- *
* @param request HttpServletRequest object to use for lookup
* @return String The ISO currency code
*/
@@ -1081,7 +1061,6 @@ public final class UtilHttp {
/**
* Returns the query string contained in a request target - basically everything
* after and including the ? character.
- *
* @param target The request target
* @return The query string
*/
@@ -1099,7 +1078,6 @@ public final class UtilHttp {
/**
* Removes the query string from a request target - basically everything
* after and including the ? character.
- *
* @param target The request target
* @return The request target string
*/
@@ -1233,7 +1211,6 @@ public final class UtilHttp {
/**
* Stream an array of bytes to the browser
* This method will close the ServletOutputStream when finished
- *
* @param response HttpServletResponse object to get OutputStream from
* @param bytes Byte array of content to stream
* @param contentType The content type to pass to the browser
@@ -1273,7 +1250,6 @@ public final class UtilHttp {
* Streams content from InputStream to the ServletOutputStream
* This method will close the ServletOutputStream when finished
* This method does not close the InputSteam passed
- *
* @param response HttpServletResponse object to get OutputStream from
* @param in InputStream of the actual content
* @param length Size (in bytes) of the content
@@ -1310,7 +1286,6 @@ public final class UtilHttp {
/**
* Stream binary content from InputStream to OutputStream
* This method does not close the streams passed
- *
* @param out OutputStream content should go to
* @param in InputStream of the actual content
* @param length Size (in bytes) of the content
@@ -1476,7 +1451,6 @@ public final class UtilHttp {
* The prefix should be a regular parameter name such as meetingDate. The
* suffix is the composite field, such as the hour of the meeting. The
* result would be meetingDate_${COMPOSITE_DELIMITER}_hour.
- *
* @param prefix
* @param suffix
* @return the composite parameter
@@ -1501,7 +1475,6 @@ public final class UtilHttp {
* {@code meetingDate_c_minutes}. Additionally, there will be a field named {@code meetingDate_c_compositeType}
* with a value of "Timestamp". where "_c_" is the {@link #COMPOSITE_DELIMITER}. These parameters will then be
* re-composed into a Timestamp object from the composite fields.
- *
* @param request the HTTP request containing the parameters
* @param prefix the string identifying the set of parameters that must be composed
* @return a composite object from data or {@code null} if not supported or a parsing error occurred.
@@ -1565,7 +1538,6 @@ public final class UtilHttp {
/**
* Returns true if the user has JavaScript enabled.
- *
* @param request
* @return whether javascript is enabled
*/
@@ -1649,7 +1621,6 @@ public final class UtilHttp {
/**
* Returns a unique Id for the current request
- *
* @param request An HttpServletRequest to get the name info from
* @return String
*/
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 ca11135..4147c8a 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
@@ -39,7 +39,6 @@ public final class UtilIO {
private UtilIO() { }
/** Copy a Reader to an Appendable.
- *
* @param reader the Reader to copy from
* @param out the Appendable to copy to
* @throws IOException if an error occurs
@@ -55,7 +54,6 @@ public final class UtilIO {
/** Convert a byte array to a string; consistently uses \n line endings
* in java. This uses a default {@link Charset UTF-8} charset.
- *
* @param bytes the array of bytes to convert
* @return the converted string, with platform line endings converted
* to \n
@@ -67,7 +65,6 @@ public final class UtilIO {
/** Convert a byte array to a string; consistently uses \n line endings
* in java. The conversion is limited to the specified offset/length
* pair, and uses a default {@link Charset UTF-8} charset.
- *
* @param bytes the array of bytes to convert
* @param offset the start of the conversion
* @param length how many bytes to convert
@@ -81,7 +78,6 @@ public final class UtilIO {
/** Convert a byte array to a string; consistently uses \n line endings
* in java. The conversion is limited to the specified offset/length
* pair, and uses the requested charset to decode the bytes.
- *
* @param bytes the array of bytes to convert
* @param charset the charset to use to convert the raw bytes
* @return the converted string, with platform line endings converted
@@ -95,7 +91,6 @@ public final class UtilIO {
* endings in java. The conversion is limited to the specified
* offset/length pair, and uses the requested charset to decode the
* bytes.
- *
* @param bytes the array of bytes to convert
* @param offset the start of the conversion
* @param length how many bytes to convert
@@ -123,7 +118,6 @@ public final class UtilIO {
* endings in java. The conversion is limited to the specified
* offset/length pair, and uses the requested {@link Charset
* charset} to decode the bytes.
- *
* @param bytes the array of bytes to convert
* @param offset the start of the conversion
* @param length how many bytes to convert
@@ -140,7 +134,6 @@ public final class UtilIO {
/** Convert an {@link InputStream} to a string; consistently uses \n line endings
* in java. This uses a default {@link Charset UTF-8} charset.
- *
* @param stream the stream of bytes to convert
* @return the converted string, with platform line endings converted
* to \n
@@ -151,7 +144,6 @@ public final class UtilIO {
/** Convert an {@link InputStream} to a string; consistently uses \n line endings
* in java. This uses a default {@link Charset UTF-8} charset.
- *
* @param stream the stream of bytes to convert
* @param charset the charset to use to convert the raw bytes
* @return the converted string, with platform line endings converted
@@ -163,7 +155,6 @@ public final class UtilIO {
/** Convert an {@link InputStream} to a string; consistently uses \n line endings
* in java. This uses a default {@link Charset UTF-8} charset.
- *
* @param stream the stream of bytes to convert
* @param charset the charset to use to convert the raw bytes
* @return the converted string, with platform line endings converted
@@ -175,7 +166,6 @@ public final class UtilIO {
/** Convert an {@link Reader} to a string; consistently uses \n line endings
* in java.
- *
* @param reader the stream of characters convert
* @return the converted string, with platform line endings converted
* to \n
@@ -216,7 +206,6 @@ public final class UtilIO {
/** Convert a \n string to a platform encoding. This uses a default
* {@link Charset UTF-8} charset.
- *
* @param file where to write the converted bytes to
* @param value the value to write
*/
@@ -226,7 +215,6 @@ public final class UtilIO {
/** Convert a \n string to a platform encoding. This uses a default
* {@link Charset UTF-8} charset.
- *
* @param out where to write the converted bytes to
* @param value the value to write
*/
@@ -236,7 +224,6 @@ public final class UtilIO {
/** Convert a \n string to a platform encoding. This uses the
* specified charset to extract the raw bytes.
- *
* @param out where to write the converted bytes to
* @param charset the charset to use to convert the raw bytes
* @param value the value to write
@@ -247,7 +234,6 @@ public final class UtilIO {
/** Convert a \n string to a platform encoding. This uses the
* specified charset to extract the raw bytes.
- *
* @param out where to write the converted bytes to
* @param charset the charset to use to convert the raw bytes
* @param value the value to write
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 8bc9636..6d39f72 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
@@ -98,7 +98,6 @@ public final class UtilMisc {
/**
* Get an iterator from a collection, returning null if collection is null
- *
* @param col The collection to be turned in to an iterator
* @return The resulting Iterator
*/
@@ -111,7 +110,6 @@ public final class UtilMisc {
/**
* Creates a pseudo-literal map corresponding to key-values.
- *
* @param kvs the key-value pairs
* @return the corresponding map.
* @throws IllegalArgumentException when the key-value list is not even.
@@ -122,7 +120,6 @@ public final class UtilMisc {
/**
* Creates a pseudo-literal map corresponding to key-values.
- *
* @param constructor the constructor used to instantiate the map
* @param kvs the key-value pairs
* @return the corresponding map.
@@ -176,7 +173,6 @@ public final class UtilMisc {
/**
* This change a Map to be Serializable by removing all entries with values that are not Serializable.
- *
* @param <V>
* @param map
*/
@@ -200,7 +196,6 @@ public final class UtilMisc {
/**
* Sort a List of Maps by specified consistent keys.
- *
* @param listOfMaps List of Map objects to sort.
* @param sortKeys List of Map keys to sort by.
* @return a new List of sorted Maps.
@@ -292,7 +287,6 @@ public final class UtilMisc {
/**
* Generates a String from given values delimited by delimiter.
- *
* @param values
* @param delimiter
* @return String
@@ -314,7 +308,6 @@ public final class UtilMisc {
/**
* Create a set from the passed objects.
- *
* @param data
* @return theSet
*/
@@ -355,7 +348,6 @@ public final class UtilMisc {
/**
* Creates a list from passed objects.
- *
* @param data
* @return list
*/
@@ -415,7 +407,6 @@ public final class UtilMisc {
/**
* Converts an <code>Object</code> to a <code>double</code>. Returns
* zero if conversion is not possible.
- *
* @param obj Object to convert
* @return double value
*/
@@ -427,7 +418,6 @@ public final class UtilMisc {
/**
* Converts an <code>Object</code> to a <code>Double</code>. Returns
* <code>null</code> if conversion is not possible.
- *
* @param obj Object to convert
* @return Double
*/
@@ -454,7 +444,6 @@ public final class UtilMisc {
/**
* Converts an <code>Object</code> to an <code>int</code>. Returns
* zero if conversion is not possible.
- *
* @param obj Object to convert
* @return int value
*/
@@ -466,7 +455,6 @@ public final class UtilMisc {
/**
* Converts an <code>Object</code> to an <code>Integer</code>. Returns
* <code>null</code> if conversion is not possible.
- *
* @param obj Object to convert
* @return Integer
*/
@@ -493,7 +481,6 @@ public final class UtilMisc {
/**
* Converts an <code>Object</code> to a <code>long</code>. Returns
* zero if conversion is not possible.
- *
* @param obj Object to convert
* @return long value
*/
@@ -505,7 +492,6 @@ public final class UtilMisc {
/**
* Converts an <code>Object</code> to a <code>Long</code>. Returns
* <code>null</code> if conversion is not possible.
- *
* @param obj Object to convert
* @return Long
*/
@@ -531,7 +517,6 @@ public final class UtilMisc {
/**
* Adds value to the key entry in theMap, or creates a new one if not already there
- *
* @param theMap
* @param key
* @param value
@@ -547,7 +532,6 @@ public final class UtilMisc {
/**
* Parse a locale string Locale object
- *
* @param localeString The locale string (en_US)
* @return Locale The new Locale object or null if no valid locale can be interpreted
*/
@@ -581,7 +565,6 @@ public final class UtilMisc {
/**
* The input can be a String, Locale, or even null and a valid Locale will always be returned; if nothing else works, returns the default locale.
- *
* @param localeObject An Object representing the locale
*/
public static Locale ensureLocale(Object localeObject) {
@@ -606,7 +589,6 @@ public final class UtilMisc {
/**
* List of domains or IP addresses to be checked to prevent Host Header Injection,
* no spaces after commas, no wildcard, can be extended of course...
- *
* @return List of domains or IP addresses to be checked to prevent Host Header Injection,
*/
public static List<String> getHostHeadersAllowed() {
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java
index 9b7ba95..433c012 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java
@@ -295,7 +295,6 @@ public final class UtilNumber {
/**
* Method to format an amount using a custom rule set.
* Current rule sets available:
- *
* @param amount - the amount to format
* @param locale - the Locale
* @return formatted string or an empty string if there was an error
@@ -312,11 +311,9 @@ public final class UtilNumber {
/**
* Method to format an amount using a custom rule set.
* Current rule sets available:
- *
* en_US
* %dollars-and-cents - 1,225.25 becomes "one thousand two hundred twenty five dollars and twenty five cents" (useful for checks)
* %dollars-and-hundreths - 1,225.25 becomes "one thousand two hundred twenty five and 25/00" (alternate for checks)
- *
* @param amount - the amount to format
* @param ruleSet - ruleSet to use
* @param rule - the name of the rule set to use (e.g., %dollars-and-hundredths)
@@ -360,7 +357,6 @@ public final class UtilNumber {
/**
* Method to turn a number such as "0.9853" into a nicely formatted percent, "98.53%".
- *
* @param number The number object to format
* @param scale How many places after the decimal to include
* @param roundingMode the RoundingMode rounding mode to apply
@@ -383,7 +379,6 @@ public final class UtilNumber {
/**
* A null-aware method for adding BigDecimal, but only for the right operand.
- *
* @param left The number to add to
* @param right The number being added; if null, then nothing will be added
* @return The result of the addition, or left if right is null.
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilObject.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilObject.java
index 10e36ea..2dd1dcb 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilObject.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilObject.java
@@ -89,7 +89,6 @@ public final class UtilObject {
/**
* Deserializes a byte array back to an object.
- *
* @param bytes the array of bytes
* @return the deserialized object.
* @throws ClassNotFoundException when the class can not be deserialized.
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilPlist.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilPlist.java
index 414781c..9a59bef 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilPlist.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilPlist.java
@@ -170,9 +170,7 @@ public final class UtilPlist {
/**
* Writes model information in the Apple EOModelBundle format.
- *
* For document structure and definition see: http://developer.apple.com/documentation/InternetWeb/Reference/WO_BundleReference/Articles/EOModelBundle.html
- *
* @param eoModelMap
* @param eomodeldFullPath
* @param filename
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java
index 68af757..818769c 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java
@@ -290,7 +290,6 @@ public final class UtilProperties implements Serializable {
* Returns a new <code>Properties</code> instance created from <code>fileName</code>.
* <p>This method is intended for low-level framework classes that need to read
* properties files before OFBiz has been fully initialized.</p>
- *
* @param fileName The full name of the properties file ("foo.properties")
* @return A new <code>Properties</code> instance created from <code>fileName</code>, or
* <code>null</code> if the file was not found
@@ -488,7 +487,6 @@ public final class UtilProperties implements Serializable {
/**
* Sets the specified value of the specified property name to the specified resource/properties in memory, does not persist it
- *
* @param resource The name of the resource
* @param name The name of the property in the resource
* @param value The value of the property to set in memory
@@ -832,10 +830,8 @@ public final class UtilProperties implements Serializable {
* <code>resource and ends with the locale's string (MyProps_en)</code>
* </li>
* </ul>
- *
* The <code>component://</code> protocol is supported in the
* <code>resource</code> parameter.
- *
* @param resource The resource to resolve
* @param locale The desired locale
* @return A URL instance or null if not found.
@@ -912,7 +908,6 @@ public final class UtilProperties implements Serializable {
* Convert XML property file to Properties instance. This method will convert
* both the Java XML properties file format and the OFBiz custom XML
* properties file format.
- *
* <p>The format of the custom XML properties file is:</p>
* <pre>
* {@code
@@ -927,7 +922,6 @@ public final class UtilProperties implements Serializable {
* }
* </pre>
* where <em>"locale 1", "locale 2"</em> are valid xml:lang values..
- *
* @param in XML file InputStream
* @param locale The desired locale
* @param properties Optional Properties object to populate
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilTimer.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilTimer.java
index 92cd6c2..29e6ea2 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilTimer.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilTimer.java
@@ -87,7 +87,6 @@ public class UtilTimer {
/**
* Creates a string with information including the passed message, the last passed message and the time since the last call, and the time since
* the beginning
- *
* @param message
* A message to put into the timer String
* @param className
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java
index f33b9b1..907344d 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java
@@ -53,7 +53,6 @@ public final class UtilURL {
* <p>This method uses various ways to locate the resource, and in all
* cases it tests to see if the resource exists - so it
* is very inefficient.</p>
- *
* @param resourceName
* @return
*/
@@ -74,7 +73,6 @@ public final class UtilURL {
* <p>This method uses various ways to locate the resource, and in all
* cases it tests to see if the resource exists - so it
* is very inefficient.</p>
- *
* @param resourceName
* @param loader
* @return
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java
index 902ada6..0929149 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java
@@ -75,80 +75,82 @@ public final class UtilValidate {
private UtilValidate() { }
/** boolean specifying by default whether or not it is okay for a String to be empty */
- private static final boolean defaultEmptyOK = true;
+ private static final boolean DEFAULT_EMPTY_OK = true;
/** digit characters */
- public static final String digits = "0123456789";
+ public static final String DIGITS = "0123456789";
/** lower-case letter characters */
- public static final String lowercaseLetters = "abcdefghijklmnopqrstuvwxyz";
+ public static final String LOWER_CASE_LETTERS = "abcdefghijklmnopqrstuvwxyz";
/** upper-case letter characters */
- public static final String uppercaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ public static final String UPPER_CASE_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
/** letter characters */
- public static final String letters = lowercaseLetters + uppercaseLetters;
+ public static final String LETTERS = LOWER_CASE_LETTERS + UPPER_CASE_LETTERS;
/** whitespace characters */
- private static final String whitespace = " \t\n\r";
+ private static final String WHITESPACE = " \t\n\r";
/** decimal point character differs by language and culture */
- public static final String decimalPointDelimiter = ".";
+ public static final String DECIMAL_POINT_DELIMITER = ".";
/** non-digit characters which are allowed in phone numbers */
- public static final String phoneNumberDelimiters = "()- ";
+ public static final String PHONE_NUMBER_DELIMITERS = "()- ";
/** characters which are allowed in US phone numbers */
- public static final String validUSPhoneChars = digits + phoneNumberDelimiters;
+ public static final String VALID_US_PHONE_CHARS = DIGITS + PHONE_NUMBER_DELIMITERS;
/** characters which are allowed in international phone numbers(a leading + is OK) */
- public static final String validWorldPhoneChars = digits + phoneNumberDelimiters + "+";
+ public static final String VALID_WORLD_PHONE_CHARS = DIGITS + PHONE_NUMBER_DELIMITERS + "+";
/** non-digit characters which are allowed in Social Security Numbers */
- public static final String SSNDelimiters = "- ";
+ public static final String SSN_DELIMITERS = "- ";
/** characters which are allowed in Social Security Numbers */
- public static final String validSSNChars = digits + SSNDelimiters;
+ public static final String VALID_SSN_CHARS = DIGITS + SSN_DELIMITERS;
- /** U.S. Social Security Numbers have 9 digits. They are formatted as 123-45-6789. */
- public static final int digitsInSocialSecurityNumber = 9;
+ /** U.S. Social Security Numbers have 9 DIGITS. They are formatted as 123-45-6789. */
+ public static final int DIGITS_IN_SSN = 9;
- /** U.S. phone numbers have 10 digits. They are formatted as 123 456 7890 or(123) 456-7890. */
- public static final int digitsInUSPhoneNumber = 10;
- public static final int digitsInUSPhoneAreaCode = 3;
- public static final int digitsInUSPhoneMainNumber = 7;
+ /** U.S. phone numbers have 10 DIGITS. They are formatted as 123 456 7890 or(123) 456-7890. */
+ public static final int DIGITS_IN_US_PHONE = 10;
+ public static final int DIGITS_IN_US_PHONE_AREA = 3;
+ public static final int DIGITS_IN_US_PHONE_MAIN = 7;
/** non-digit characters which are allowed in ZIP Codes */
- public static final String ZipCodeDelimiters = "-";
+ public static final String ZIP_CODE_DELIMITERS = "-";
/** our preferred delimiter for reformatting ZIP Codes */
- public static final String ZipCodeDelimeter = "-";
+ public static final String ZIP_CODE_DELIMITER = "-";
/** characters which are allowed in Social Security Numbers */
- public static final String validZipCodeChars = digits + ZipCodeDelimiters;
+ public static final String VALID_ZIP_CODE_CHARS = DIGITS + ZIP_CODE_DELIMITERS;
/** U.S. ZIP codes have 5 or 9 digits. They are formatted as 12345 or 12345-6789. */
- public static final int digitsInZipCode1 = 5;
+ public static final int DIGITS_IN_ZIP_CODE_1 = 5;
/** U.S. ZIP codes have 5 or 9 digits. They are formatted as 12345 or 12345-6789. */
- public static final int digitsInZipCode2 = 9;
+ public static final int DIGITS_IN_ZIP_CODE_2 = 9;
/** non-digit characters which are allowed in credit card numbers */
- public static final String creditCardDelimiters = " -";
+ public static final String CREDIT_CARD_DELIMITERS = " -";
/** An array of ints representing the number of days in each month of the year.
* Note: February varies depending on the year */
- static final int[] daysInMonth = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+ static final int[] DAYS_IN_MONTH = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
/** Delimiter for USStateCodes String */
- public static final String USStateCodeDelimiter = "|";
+ public static final String US_STATE_CODE_DELIMITER = "|";
/** Valid U.S. Postal Codes for states, territories, armed forces, etc.
* See http://www.usps.gov/ncsc/lookups/abbr_state.txt. */
- public static final String USStateCodes = "AL|AK|AS|AZ|AR|CA|CO|CT|DE|DC|FM|FL|GA|GU|HI|ID|IL|IN|IA|KS|KY|LA|ME|MH|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|MP|OH|OK|OR|PW|PA|PR|RI|SC|SD|TN|TX|UT|VT|VI|VA|WA|WV|WI|WY|AE|AA|AE|AE|AP";
+ public static final String US_STATE_CODES = "AL|AK|AS|AZ|AR|CA|CO|CT|DE|DC|FM|FL|GA|GU|HI|ID|IL|IN|IA|KS|KY|LA|ME|MH|MD|MA|MI|MN|MS|MO|MT|NE|NV|"
+ + "NH|NJ|NM|NY|NC|ND|MP|OH|OK|OR|PW|PA|PR|RI|SC|SD|TN|TX|UT|VT|VI|VA|WA|WV|WI|WY|AE|AA|AE|AE|AP";
/** Valid contiguous U.S. postal codes */
- public static final String ContiguousUSStateCodes = "AL|AZ|AR|CA|CO|CT|DE|DC|FL|GA|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY";
+ public static final String CONTIGUOUS_US_STATE_CODES = "AL|AZ|AR|CA|CO|CT|DE|DC|FL|GA|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|"
+ + "NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY";
/** Check whether an object is empty, will see if it is a String, Map, Collection, etc. */
public static boolean isEmpty(Object o) {
@@ -213,7 +215,7 @@ public final class UtilValidate {
// Check that current character isn't whitespace.
char c = s.charAt(i);
- if (whitespace.indexOf(c) == -1) {
+ if (WHITESPACE.indexOf(c) == -1) {
return false;
}
}
@@ -239,13 +241,12 @@ public final class UtilValidate {
}
/** Returns true if all characters in string s are numbers.
- *
* Accepts non-signed integers only. Does not accept floating
* point, exponential notation, etc.
*/
public static boolean isInteger(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
// Search through string's characters one by one
@@ -266,12 +267,11 @@ public final class UtilValidate {
/** Returns true if all characters are numbers;
* first character is allowed to be + or - as well.
- *
* Does not accept floating point, exponential notation, etc.
*/
private static boolean isSignedInteger(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
try {
Integer.parseInt(s);
@@ -283,12 +283,11 @@ public final class UtilValidate {
/** Returns true if all characters are numbers;
* first character is allowed to be + or - as well.
- *
* Does not accept floating point, exponential notation, etc.
*/
public static boolean isSignedLong(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
try {
Long.parseLong(s);
@@ -304,7 +303,7 @@ public final class UtilValidate {
*/
public static boolean isPositiveInteger(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
try {
@@ -320,7 +319,7 @@ public final class UtilValidate {
*/
public static boolean isNonnegativeInteger(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
try {
@@ -336,7 +335,7 @@ public final class UtilValidate {
*/
public static boolean isNegativeInteger(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
try {
@@ -352,7 +351,7 @@ public final class UtilValidate {
*/
public static boolean isNonpositiveInteger(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
try {
@@ -364,21 +363,19 @@ public final class UtilValidate {
}
/** True if string s is an unsigned floating point(real) number.
- *
* Also returns true for unsigned integers. If you wish
* to distinguish between integers and floating point numbers,
* first call isInteger, then call isFloat.
- *
* Does not accept exponential notation.
*/
public static boolean isFloat(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
boolean seenDecimalPoint = false;
- if (s.startsWith(decimalPointDelimiter)) {
+ if (s.startsWith(DECIMAL_POINT_DELIMITER)) {
return false;
}
@@ -389,7 +386,7 @@ public final class UtilValidate {
// Check that current character is number.
char c = s.charAt(i);
- if (c == decimalPointDelimiter.charAt(0)) {
+ if (c == DECIMAL_POINT_DELIMITER.charAt(0)) {
if (!seenDecimalPoint) {
seenDecimalPoint = true;
} else {
@@ -409,7 +406,7 @@ public final class UtilValidate {
*/
public static boolean isFloat(String s, boolean allowNegative, boolean allowPositive, int minDecimal, int maxDecimal) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
try {
@@ -433,7 +430,7 @@ public final class UtilValidate {
*/
public static boolean isDouble(String s, boolean allowNegative, boolean allowPositive, int minDecimal, int maxDecimal) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
try {
@@ -455,14 +452,13 @@ public final class UtilValidate {
/** True if string s is a signed or unsigned floating point
* (real) number. First character is allowed to be + or -.
- *
* Also returns true for unsigned integers. If you wish
* to distinguish between integers and floating point numbers,
* first call isSignedInteger, then call isSignedFloat.
*/
public static boolean isSignedFloat(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
try {
Float.parseFloat(s);
@@ -474,14 +470,13 @@ public final class UtilValidate {
/** True if string s is a signed or unsigned floating point
* (real) number. First character is allowed to be + or -.
- *
* Also returns true for unsigned integers. If you wish
* to distinguish between integers and floating point numbers,
* first call isSignedInteger, then call isSignedFloat.
*/
public static boolean isSignedDouble(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
try {
Double.parseDouble(s);
@@ -492,13 +487,12 @@ public final class UtilValidate {
}
/** Returns true if string s is letters only.
- *
* NOTE: This should handle i18n version to support European characters, etc.
* since it now uses Character.isLetter()
*/
public static boolean isAlphabetic(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
// Search through string's characters one by one
@@ -518,14 +512,13 @@ public final class UtilValidate {
}
/** Returns true if string s is English letters (A .. Z, a..z) and numbers only.
- *
* NOTE: Need i18n version to support European characters.
* This could be tricky due to different character
* sets and orderings for various languages and platforms.
*/
public static boolean isAlphanumeric(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
// Search through string's characters one by one
@@ -549,23 +542,23 @@ public final class UtilValidate {
/** isSSN returns true if string s is a valid U.S. Social Security Number. Must be 9 digits. */
public static boolean isSSN(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
- String normalizedSSN = stripCharsInBag(s, SSNDelimiters);
+ String normalizedSSN = stripCharsInBag(s, SSN_DELIMITERS);
- return (isInteger(normalizedSSN) && normalizedSSN.length() == digitsInSocialSecurityNumber);
+ return (isInteger(normalizedSSN) && normalizedSSN.length() == DIGITS_IN_SSN);
}
/** isZIPCode returns true if string s is a valid U.S. ZIP code. Must be 5 or 9 digits only. */
public static boolean isZipCode(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
- String normalizedZip = stripCharsInBag(s, ZipCodeDelimiters);
+ String normalizedZip = stripCharsInBag(s, ZIP_CODE_DELIMITERS);
- return (isInteger(normalizedZip) && ((normalizedZip.length() == digitsInZipCode1) || (normalizedZip.length() == digitsInZipCode2)));
+ return (isInteger(normalizedZip) && ((normalizedZip.length() == DIGITS_IN_ZIP_CODE_1) || (normalizedZip.length() == DIGITS_IN_ZIP_CODE_2)));
}
/** Returns true if string s is a valid contiguous U.S. Zip code. Must be 5 or 9 digits only. */
@@ -573,9 +566,9 @@ public final class UtilValidate {
boolean retval = false;
if (isZipCode(s)) {
if (isEmpty(s)) {
- retval = defaultEmptyOK;
+ retval = DEFAULT_EMPTY_OK;
} else {
- String normalizedZip = s.substring(0,5);
+ String normalizedZip = s.substring(0, 5);
int iZip = Integer.parseInt(normalizedZip);
if ((iZip >= 96701 && iZip <= 96898) || (iZip >= 99501 && iZip <= 99950)) {
retval = false;
@@ -590,22 +583,22 @@ public final class UtilValidate {
/** Return true if s is a valid U.S. Postal Code (abbreviation for state). */
public static boolean isStateCode(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
- return ((USStateCodes.indexOf(s) != -1) && (s.indexOf(USStateCodeDelimiter) == -1));
+ return ((US_STATE_CODES.indexOf(s) != -1) && (s.indexOf(US_STATE_CODE_DELIMITER) == -1));
}
/** Return true if s is a valid contiguous U.S. Postal Code (abbreviation for state). */
public static boolean isContiguousStateCode(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
- return ((ContiguousUSStateCodes.indexOf(s) != -1) && (s.indexOf(USStateCodeDelimiter) == -1));
+ return ((CONTIGUOUS_US_STATE_CODES.indexOf(s) != -1) && (s.indexOf(US_STATE_CODE_DELIMITER) == -1));
}
public static boolean isEmail(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
return EmailValidator.getInstance().isValid(s);
}
@@ -615,7 +608,7 @@ public final class UtilValidate {
*/
public static boolean isEmailList(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
String[] emails = s.split(",");
for (String email : emails) {
@@ -632,20 +625,19 @@ public final class UtilValidate {
*/
public static boolean isUrl(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
return s.indexOf("://") != -1;
}
/** isYear returns true if string s is a valid
* Year number. Must be 2 or 4 digits only.
- *
* For Year 2000 compliance, you are advised
* to use 4-digit year numbers everywhere.
*/
public static boolean isYear(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
return isNonnegativeInteger(s) && ((s.length() == 2) || (s.length() == 4));
}
@@ -655,7 +647,7 @@ public final class UtilValidate {
*/
public static boolean isIntegerInRange(String s, int a, int b) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
// Catch non-integer strings to avoid creating a NaN below,
// which isn't available on JavaScript 1.0 for Windows.
@@ -674,7 +666,7 @@ public final class UtilValidate {
/** isMonth returns true if string s is a valid month number between 1 and 12. */
public static boolean isMonth(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
return isIntegerInRange(s, 1, 12);
}
@@ -682,7 +674,7 @@ public final class UtilValidate {
/** isDay returns true if string s is a valid day number between 1 and 31. */
public static boolean isDay(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
return isIntegerInRange(s, 1, 31);
}
@@ -697,7 +689,7 @@ public final class UtilValidate {
/** isHour returns true if string s is a valid number between 0 and 23. */
public static boolean isHour(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
return isIntegerInRange(s, 0, 23);
}
@@ -705,7 +697,7 @@ public final class UtilValidate {
/** isMinute returns true if string s is a valid number between 0 and 59. */
public static boolean isMinute(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
return isIntegerInRange(s, 0, 59);
}
@@ -713,7 +705,7 @@ public final class UtilValidate {
/** isSecond returns true if string s is a valid number between 0 and 59. */
public static boolean isSecond(String s) {
if (isEmpty(s)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
return isIntegerInRange(s, 0, 59);
}
@@ -730,13 +722,13 @@ public final class UtilValidate {
int intDay = Integer.parseInt(day);
// catch invalid days, except for February, so intDay > daysInMonth[intMonth - 1]
- return !(intDay > daysInMonth[intMonth - 1]) && !((intMonth == 2) && (intDay > daysInFebruary(intYear)));
+ return !(intDay > DAYS_IN_MONTH[intMonth - 1]) && !((intMonth == 2) && (intDay > daysInFebruary(intYear)));
}
/** isDate returns true if string argument date forms a valid date. */
public static boolean isDate(String date) {
if (isEmpty(date)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
String month;
String day;
@@ -758,7 +750,7 @@ public final class UtilValidate {
/** isDate returns true if string argument date forms a valid date and is after today. */
public static boolean isDateAfterToday(String date) {
if (isEmpty(date)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
int dateSlash1 = date.indexOf("/");
int dateSlash2 = date.lastIndexOf("/");
@@ -807,14 +799,13 @@ public final class UtilValidate {
/** isDate returns true if string argument date forms a valid date and is before today. */
public static boolean isDateBeforeToday(String date) {
if (isEmpty(date)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
int dateSlash1 = date.indexOf("/");
int dateSlash2 = date.lastIndexOf("/");
- if (dateSlash1 <= 0)
- {
- return defaultEmptyOK; // In this case an issue number has been provided (requires a javascript check in template!)
+ if (dateSlash1 <= 0) {
+ return DEFAULT_EMPTY_OK; // In this case an issue number has been provided (requires a javascript check in template!)
}
java.util.Date passed = null;
@@ -854,7 +845,7 @@ public final class UtilValidate {
return false;
}
- public static boolean isDateBeforeNow(Timestamp date) {
+ public static boolean isDateBeforeNow(Timestamp date) {
Timestamp now = UtilDateTime.nowTimestamp();
if (date != null) {
return date.before(now);
@@ -862,7 +853,7 @@ public final class UtilValidate {
return false;
}
- public static boolean isDateAfterNow(Timestamp date) {
+ public static boolean isDateAfterNow(Timestamp date) {
Timestamp now = UtilDateTime.nowTimestamp();
if (date != null) {
return date.after(now);
@@ -878,7 +869,7 @@ public final class UtilValidate {
/** isTime returns true if string argument time forms a valid time. */
public static boolean isTime(String time) {
if (isEmpty(time)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
String hour;
@@ -903,33 +894,30 @@ public final class UtilValidate {
}
/** Check to see if a card number is a valid ValueLink Gift Card
- *
* @param stPassed a string representing a valuelink gift card
* @return true, if the number passed simple checks
*/
public static boolean isValueLinkCard(String stPassed) {
if (isEmpty(stPassed)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
- String st = stripCharsInBag(stPassed, creditCardDelimiters);
+ String st = stripCharsInBag(stPassed, CREDIT_CARD_DELIMITERS);
return st.length() == 16 && (st.startsWith("7") || st.startsWith("6"));
}
/** Check to see if a card number is a valid OFB Gift Card (Certifiicate)
- *
* @param stPassed a string representing a gift card
* @return tru, if the number passed simple checks
*/
public static boolean isOFBGiftCard(String stPassed) {
if (isEmpty(stPassed)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
- String st = stripCharsInBag(stPassed, creditCardDelimiters);
+ String st = stripCharsInBag(stPassed, CREDIT_CARD_DELIMITERS);
return st.length() == 15 && sumIsMod10(getLuhnSum(st));
}
/** Check to see if a card number is a supported Gift Card
- *
* @param stPassed a string representing a gift card
* @return true, if the number passed simple checks
*/
@@ -968,22 +956,20 @@ public final class UtilValidate {
}
/** Checks credit card number with Luhn Mod-10 test
- *
* @param stPassed a string representing a credit card number
* @return true, if the credit card number passes the Luhn Mod-10 test, false otherwise
*/
public static boolean isCreditCard(String stPassed) {
if (isEmpty(stPassed)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
- String st = stripCharsInBag(stPassed, creditCardDelimiters);
+ String st = stripCharsInBag(stPassed, CREDIT_CARD_DELIMITERS);
// encoding only works on cars with less the 19 digits, so st.length() > 19
return isInteger(st) && !(st.length() > 19) && sumIsMod10(getLuhnSum(st));
}
/** Checks to see if the cc number is a valid Visa number
- *
* @param cc a string representing a credit card number; Sample number: 4111 1111 1111 1111(16 digits)
* @return true, if the credit card number is a valid VISA number, false otherwise
*/
@@ -995,8 +981,8 @@ public final class UtilValidate {
}
/** Checks to see if the cc number is a valid Master Card number
- *
- * @param cc a string representing a credit card number; MasterCard numbers either start with the numbers 51 through 55 or with the numbers 2221 through 2720. All have 16 digits; Sample number: 5500 0000 0000 0004(16 digits)
+ * @param cc a string representing a credit card number; MasterCard numbers either start with the numbers 51 through 55 or with the numbers 2221
+ * through 2720. All have 16 digits; Sample number: 5500 0000 0000 0004(16 digits)
* @return true, if the credit card number is a valid MasterCard number, false otherwise
*/
public static boolean isMasterCard(String cc) {
@@ -1048,7 +1034,8 @@ public final class UtilValidate {
}
/** Checks to see if the cc number is a valid Discover number
- * @param cc - a string representing a credit card number; Discover card numbers begin with 6011 or 65. All have 16 digits; Sample number: 6011000000000004(16 digits)
+ * @param cc - a string representing a credit card number; Discover card numbers begin with 6011 or 65. All have 16 digits;
+ * Sample number: 6011000000000004(16 digits)
* @return true, if the credit card number is a valid Discover card number, false otherwise
*/
public static boolean isDiscover(String cc) {
@@ -1075,14 +1062,16 @@ public final class UtilValidate {
}
/** Checks to see if the cc number is a valid JCB number
- * @param cc - a string representing a credit card number; JCB cards beginning with 2131 or 1800 have 15 digits. JCB cards beginning with 35 have 16 digits;Sample number: 3088000000000009(16 digits)
+ * @param cc - a string representing a credit card number; JCB cards beginning with 2131 or 1800 have 15 digits. JCB cards beginning
+ * with 35 have 16 digits;Sample number: 3088000000000009(16 digits)
* @return true, if the credit card number is a valid JCB card number, false otherwise
*/
public static boolean isJCB(String cc) {
String first4digs = cc.substring(0, 4);
String first2digs = cc.substring(0, 2);
- if (((Integer.compare(cc.length(), 16) == 0) && "35".equals(first2digs)) || ((Integer.compare(cc.length(), 15) == 0) && ("2131".equals(first4digs) || "1800".equals(first4digs)))) {
+ if (((Integer.compare(cc.length(), 16) == 0) && "35".equals(first2digs)) || ((Integer.compare(cc.length(), 15) == 0)
+ && ("2131".equals(first4digs) || "1800".equals(first4digs)))) {
return isCreditCard(cc);
}
return false;
@@ -1148,9 +1137,9 @@ public final class UtilValidate {
*/
public static boolean isAnyCard(String ccPassed) {
if (isEmpty(ccPassed)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
- String cc = stripCharsInBag(ccPassed, creditCardDelimiters);
+ String cc = stripCharsInBag(ccPassed, CREDIT_CARD_DELIMITERS);
return isCreditCard(cc) && (isMasterCard(cc) || isVisa(cc) || isAmericanExpress(cc) || isDinersClub(cc)
|| isDiscover(cc) || isEnRoute(cc) || isJCB(cc) || isSolo(cc) || isSwitch(cc) || isVisaElectron(cc));
}
@@ -1163,7 +1152,7 @@ public final class UtilValidate {
if (isEmpty(ccPassed)) {
return "Unknown";
}
- String cc = stripCharsInBag(ccPassed, creditCardDelimiters);
+ String cc = stripCharsInBag(ccPassed, CREDIT_CARD_DELIMITERS);
if (!isCreditCard(cc)) {
return "Unknown";
@@ -1209,9 +1198,9 @@ public final class UtilValidate {
*/
public static boolean isCardMatch(String cardType, String cardNumberPassed) {
if (isEmpty(cardType) || isEmpty(cardNumberPassed)) {
- return defaultEmptyOK;
+ return DEFAULT_EMPTY_OK;
}
- String cardNumber = stripCharsInBag(cardNumberPassed, creditCardDelimiters);
+ String cardNumber = stripCharsInBag(cardNumberPassed, CREDIT_CARD_DELIMITERS);
if (("CCT_VISA".equalsIgnoreCase(cardType)) && (isVisa(cardNumber))) {
return true;
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java
index 0b99848..f9f50b9 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java
@@ -250,7 +250,6 @@ public final class UtilXml {
// ----- Java Object Marshalling/Unmarshalling ----- //
/** Deserialize an object from an <code>InputStream</code>.
- *
* @param input The <code>InputStream</code>
* @return The deserialized <code>Object</code>
*/
@@ -259,7 +258,6 @@ public final class UtilXml {
}
/** Deserialize an object from a <code>Reader</code>.
- *
* @param reader The <code>Reader</code>
* @return The deserialized <code>Object</code>
*/
@@ -268,7 +266,6 @@ public final class UtilXml {
}
/** Deserialize an object from a <code>String</code>.
- *
* @param str The <code>String</code>
* @return The deserialized <code>Object</code>
*/
@@ -277,7 +274,6 @@ public final class UtilXml {
}
/** Serialize an object to an XML <code>String</code>.
- *
* @param obj The object to serialize
* @return An XML <code>String</code>
*/
@@ -286,7 +282,6 @@ public final class UtilXml {
}
/** Serialize an object to an <code>OutputStream</code>.
- *
* @param obj The object to serialize
* @param output The <code>OutputStream</code>
*/
@@ -295,7 +290,6 @@ public final class UtilXml {
}
/** Serialize an object to a <code>Writer</code>.
- *
* @param obj The object to serialize
* @param writer The <code>Writer</code>
*/
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/CacheLine.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/CacheLine.java
index f10070f..5adff0f 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/CacheLine.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/CacheLine.java
@@ -27,8 +27,14 @@ public abstract class CacheLine<V> extends ExecutionPool.Pulse {
abstract CacheLine<V> changeLine(boolean useSoftReference, long expireTimeNanos);
abstract void remove();
+
+ /**
+ * Different expire time boolean.
+ * @param expireTimeNanos the expire time nanos
+ * @return the boolean
+ */
boolean differentExpireTime(long expireTimeNanos) {
- return this.expireTimeNanos - loadTimeNanos - expireTimeNanos != 0;
+ return this.getExpireTimeNanos() - getLoadTimeNanos() - expireTimeNanos != 0;
}
public abstract V getValue();
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 8701992..52a4e85 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
@@ -43,9 +43,9 @@ import org.apache.ofbiz.base.util.string.UelUtil;
@SuppressWarnings("serial")
public final class FlexibleMapAccessor<T> implements Serializable, IsEmpty {
private static final String MODULE = FlexibleMapAccessor.class.getName();
- private static final UtilCache<String, FlexibleMapAccessor<Object>> fmaCache =
+ private static final UtilCache<String, FlexibleMapAccessor<Object>> FMA_CACHE =
UtilCache.createUtilCache("flexibleMapAccessor.ExpressionCache");
- private static final FlexibleMapAccessor<?> nullFma = new FlexibleMapAccessor<>("");
+ private static final FlexibleMapAccessor<?> NULL_FMA = new FlexibleMapAccessor<>("");
private final boolean isEmpty;
private final String original;
@@ -67,10 +67,11 @@ public final class FlexibleMapAccessor<T> implements Serializable, IsEmpty {
isAscending = true;
name = name.substring(1);
}
- if (name.contains(FlexibleStringExpander.openBracket)) {
+ if (name.contains(FlexibleStringExpander.OPEN_BRACKET)) {
fse = FlexibleStringExpander.getInstance(name);
} else {
- bracketedOriginal = FlexibleStringExpander.openBracket.concat(UelUtil.prepareExpression(name).concat(FlexibleStringExpander.closeBracket));
+ bracketedOriginal = FlexibleStringExpander.OPEN_BRACKET.concat(UelUtil.prepareExpression(name)
+ .concat(FlexibleStringExpander.CLOSE_BRACKET));
}
}
this.bracketedOriginal = bracketedOriginal;
@@ -87,12 +88,12 @@ public final class FlexibleMapAccessor<T> implements Serializable, IsEmpty {
*/
public static <T> FlexibleMapAccessor<T> getInstance(String original) {
if (UtilValidate.isEmpty(original) || "null".equals(original)) {
- return UtilGenerics.cast(nullFma);
+ return UtilGenerics.cast(NULL_FMA);
}
- FlexibleMapAccessor<T> fma = UtilGenerics.cast(fmaCache.get(original));
+ FlexibleMapAccessor<T> fma = UtilGenerics.cast(FMA_CACHE.get(original));
if (fma == null) {
- fmaCache.putIfAbsent(original, new FlexibleMapAccessor<>(original));
- fma = UtilGenerics.cast(fmaCache.get(original));
+ FMA_CACHE.putIfAbsent(original, new FlexibleMapAccessor<>(original));
+ fma = UtilGenerics.cast(FMA_CACHE.get(original));
}
return fma;
}
@@ -205,7 +206,8 @@ public final class FlexibleMapAccessor<T> implements Serializable, IsEmpty {
private String getExpression(Map<String, ? extends Object> base) {
String expression = null;
if (this.fse != null) {
- expression = FlexibleStringExpander.openBracket.concat(UelUtil.prepareExpression(this.fse.expandString(base)).concat(FlexibleStringExpander.closeBracket));
+ expression = FlexibleStringExpander.OPEN_BRACKET.concat(UelUtil.prepareExpression(this.fse.expandString(base))
+ .concat(FlexibleStringExpander.CLOSE_BRACKET));
} else {
expression = this.bracketedOriginal;
}
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/LifoSet.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/LifoSet.java
index 2557ef0..1c66779 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/LifoSet.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/LifoSet.java
@@ -47,7 +47,6 @@ public class LifoSet<V> extends AbstractSet<V> implements Serializable {
* Constructs a set containing the elements of the specified
* collection, in the order they are returned by the collection's
* iterator.
- *
* @param capacity the collection whose elements are to be placed into this set.
*/
public LifoSet(int capacity) {
@@ -101,7 +100,6 @@ public class LifoSet<V> extends AbstractSet<V> implements Serializable {
/**
* @see java.util.Stack#empty()
- *
* @return true if and only if this stack contains no items; false otherwise
*/
public boolean empty() {
@@ -110,7 +108,6 @@ public class LifoSet<V> extends AbstractSet<V> implements Serializable {
/**
* @see java.util.Stack#push(java.lang.Object)
- *
* @param item The item to be pushed onto this stack
*/
public void push(V item) {
@@ -119,7 +116,6 @@ public class LifoSet<V> extends AbstractSet<V> implements Serializable {
/**
* @see java.util.Stack#pop()
- *
* @return The object at the top of this stack
* @throws EmptyStackException If this stack is empty
*/
@@ -132,7 +128,6 @@ public class LifoSet<V> extends AbstractSet<V> implements Serializable {
/**
* @see java.util.Stack#peek()
- *
* @return The object at the top of this stack
* @throws EmptyStackException If this stack is empty
*/
@@ -145,7 +140,6 @@ public class LifoSet<V> extends AbstractSet<V> implements Serializable {
/**
* @see java.util.Stack#search(java.lang.Object)
- *
* @param item The desired object
* @return The 1-based position from the top of the stack where the object is located;
* the return value -1 indicates that the object is not on the stack
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/MultivaluedMapContext.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/MultivaluedMapContext.java
index 5ec4448..048228e 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/MultivaluedMapContext.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/MultivaluedMapContext.java
@@ -40,7 +40,6 @@ public class MultivaluedMapContext<K, V> extends MapContext<K, List<V>> {
/**
* Associate {@code key} with the single value {@code value}.
* If other values are already associated with {@code key} then override them.
- *
* @param key the key to associate {@code value} with
* @param value the value to add to the context
*/
@@ -54,7 +53,6 @@ public class MultivaluedMapContext<K, V> extends MapContext<K, List<V>> {
* Associate {@code key} with the single value {@code value}.
* If other values are already associated with {@code key},
* then add {@code value} to them.
- *
* @param key the key to associate {@code value} with
* @param value the value to add to the context
*/
@@ -75,7 +73,6 @@ public class MultivaluedMapContext<K, V> extends MapContext<K, List<V>> {
/**
* Get the first value contained in the list of values associated with {@code key}.
- *
* @param key a candidate key
* @return the first value associated with {@code key} or null if no value
* is associated with it.
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 2dc63bb..7fc00db 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
@@ -54,10 +54,10 @@ import org.apache.ofbiz.base.util.cache.UtilCache;
public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
private static final String MODULE = FlexibleStringExpander.class.getName();
- public static final String openBracket = "${";
- public static final String closeBracket = "}";
- protected static final UtilCache<Key, FlexibleStringExpander> exprCache = UtilCache.createUtilCache("flexibleStringExpander.ExpressionCache");
- protected static final FlexibleStringExpander nullExpr = new ConstSimpleElem(new char[0]);
+ public static final String OPEN_BRACKET = "${";
+ public static final String CLOSE_BRACKET = "}";
+ private static final UtilCache<Key, FlexibleStringExpander> EXPR_CACHE = UtilCache.createUtilCache("flexibleStringExpander.ExpressionCache");
+ private static final FlexibleStringExpander NULL_EXPR = new ConstSimpleElem(new char[0]);
/**
* Returns <code>true</code> if <code>fse</code> contains a <code>String</code> constant.
@@ -117,7 +117,6 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
* argument, and
* <code>FlexibleStringExpander.getInstance(expression).expandString(context)</code>
* returns an empty <code>String</code>.</p>
- *
* @param expression The original expression
* @param context The evaluation context
* @return The original expression's evaluation result as a <code>String</code>
@@ -135,7 +134,6 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
* argument, and
* <code>FlexibleStringExpander.getInstance(expression).expandString(context, locale)</code>
* returns an empty <code>String</code>.</p>
- *
* @param expression The original expression
* @param context The evaluation context
* @param locale The locale to be used for localization
@@ -154,7 +152,6 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
* argument, and
* <code>FlexibleStringExpander.getInstance(expression).expandString(context, timeZone, locale)</code>
* returns an empty <code>String</code>.</p>
- *
* @param expression The original expression
* @param context The evaluation context
* @param timeZone The time zone to be used for localization
@@ -165,7 +162,7 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
if (expression == null) {
return "";
}
- if (context == null || !expression.contains(openBracket)) {
+ if (context == null || !expression.contains(OPEN_BRACKET)) {
return expression;
}
FlexibleStringExpander fse = FlexibleStringExpander.getInstance(expression);
@@ -183,7 +180,6 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
* will return the original <code>String</code>. The object returned by
* this method is very compact - taking less memory than the original
* <code>String</code>.</p>
- *
* @param expression The original expression
* @return A <code>FlexibleStringExpander</code> instance
*/
@@ -202,27 +198,26 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
* will return the original <code>String</code>. The object returned by
* this method is very compact - taking less memory than the original
* <code>String</code>.</p>
- *
* @param expression The original expression
* @param useCache whether to store things into a global cache
* @return A <code>FlexibleStringExpander</code> instance
*/
public static FlexibleStringExpander getInstance(String expression, boolean useCache) {
if (UtilValidate.isEmpty(expression)) {
- return nullExpr;
+ return NULL_EXPR;
}
return getInstance(expression, expression.toCharArray(), 0, expression.length(), useCache);
}
private static FlexibleStringExpander getInstance(String expression, char[] chars, int offset, int length, boolean useCache) {
if (length == 0) {
- return nullExpr;
+ return NULL_EXPR;
}
if (!useCache) {
return parse(chars, offset, length);
}
// Remove the next nine lines to cache all expressions
- if (!expression.contains(openBracket)) {
+ if (!expression.contains(OPEN_BRACKET)) {
if (chars.length == length) {
return new ConstSimpleElem(chars);
} else {
@@ -230,10 +225,10 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
}
}
Key key = chars.length == length ? new SimpleKey(chars) : new OffsetKey(chars, offset, length);
- FlexibleStringExpander fse = exprCache.get(key);
+ FlexibleStringExpander fse = EXPR_CACHE.get(key);
if (fse == null) {
- exprCache.put(key, parse(chars, offset, length));
- fse = exprCache.get(key);
+ EXPR_CACHE.put(key, parse(chars, offset, length));
+ fse = EXPR_CACHE.get(key);
}
return fse;
}
@@ -293,7 +288,7 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
protected static FlexibleStringExpander[] getStrElems(char[] chars, int offset, int length) {
String expression = new String(chars, 0, length + offset);
- int start = expression.indexOf(openBracket, offset);
+ int start = expression.indexOf(OPEN_BRACKET, offset);
if (start == -1) {
return new FlexibleStringExpander[] {new ConstOffsetElem(chars, offset, length) };
}
@@ -302,7 +297,7 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
int currentInd = offset;
int end = -1;
while (start != -1) {
- end = expression.indexOf(closeBracket, start);
+ end = expression.indexOf(CLOSE_BRACKET, start);
if (end == -1) {
Debug.logWarning("Found a ${ without a closing } (curly-brace) in the String: " + expression, MODULE);
break;
@@ -311,7 +306,7 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
boolean escapedExpression = (start - 1 >= 0 && expression.charAt(start - 1) == '\\');
if (start > currentInd) {
// append everything from the current index to the start of the expression
- strElems.add(new ConstOffsetElem(chars, currentInd, (escapedExpression ? start -1 : start) - currentInd));
+ strElems.add(new ConstOffsetElem(chars, currentInd, (escapedExpression ? start - 1 : start) - currentInd));
}
if (expression.indexOf("groovy:", start + 2) == start + 2 && !escapedExpression) {
// checks to see if this starts with a "groovy:", if so treat the rest of the expression as a groovy scriptlet
@@ -320,7 +315,7 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
// Scan for matching closing bracket
int ptr = expression.indexOf("{", start + 2);
while (ptr != -1 && end != -1 && ptr < end) {
- end = expression.indexOf(closeBracket, end + 1);
+ end = expression.indexOf(CLOSE_BRACKET, end + 1);
ptr = expression.indexOf("{", ptr + 1);
}
if (end == -1) {
@@ -335,10 +330,12 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
int closeParen = currencyPos > 0 ? subExpression.indexOf(")", currencyPos + 10) : -1;
if (closeParen != -1) {
strElems.add(new CurrElem(chars, start, Math.min(end + 1, start + length) - start, start + 2, end - start - 1));
- } else if (subExpression.contains(openBracket)) {
- strElems.add(new NestedVarElem(chars, start, Math.min(end + 1, start + length) - start, start + 2, Math.min(end - 2, start + length) - start));
+ } else if (subExpression.contains(OPEN_BRACKET)) {
+ strElems.add(new NestedVarElem(chars, start, Math.min(end + 1, start + length) - start, start + 2,
+ Math.min(end - 2, start + length) - start));
} else {
- strElems.add(new VarElem(chars, start, Math.min(end + 1, start + length) - start, start + 2, Math.min(end - 2, start + length) - start));
+ strElems.add(new VarElem(chars, start, Math.min(end + 1, start + length) - start, start + 2,
+ Math.min(end - 2, start + length) - start));
}
}
}
@@ -347,7 +344,7 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
if (currentInd > origLen + offset) {
currentInd = origLen + offset;
}
- start = expression.indexOf(openBracket, currentInd);
+ start = expression.indexOf(OPEN_BRACKET, currentInd);
}
// append the rest of the original string, ie after the last expression
if (currentInd < origLen + offset) {
@@ -357,8 +354,32 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
}
// Note: a character array is used instead of a String to keep the memory footprint small.
- protected final char[] chars;
- protected int hint = 20;
+ private final char[] chars;
+ private int hint = 20;
+
+ /**
+ * Get chars char [ ].
+ * @return the char [ ]
+ */
+ public char[] getChars() {
+ return chars;
+ }
+
+ /**
+ * Gets hint.
+ * @return the hint
+ */
+ public int getHint() {
+ return hint;
+ }
+
+ /**
+ * Sets hint.
+ * @param hint the hint
+ */
+ public void setHint(int hint) {
+ this.hint = hint;
+ }
protected FlexibleStringExpander(char[] chars) {
this.chars = chars;
@@ -397,7 +418,6 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
/** Evaluate this object's expression and return the result as a <code>String</code>.
* Null or empty expressions return an empty <code>String</code>.
* A <code>null context</code> argument will return the original expression.
- *
* @param context The evaluation context
* @return This object's expression result as a <code>String</code>
*/
@@ -408,7 +428,6 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
/** Evaluate this object's expression and return the result as a <code>String</code>.
* Null or empty expressions return an empty <code>String</code>.
* A <code>null context</code> argument will return the original expression.
- *
* @param context The evaluation context
* @param locale The locale to be used for localization
* @return This object's expression result as a <code>String</code>
@@ -420,7 +439,6 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
/** Evaluate this object's expression and return the result as a <code>String</code>.
* Null or empty expressions return an empty <code>String</code>.
* A <code>null context</code> argument will return the original expression.
- *
* @param context The evaluation context
* @param timeZone The time zone to be used for localization
* @param locale The locale to be used for localization
@@ -455,7 +473,6 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
/** Evaluate this object's expression and return the result as an <code>Object</code>.
* Null or empty expressions return an empty <code>String</code>.
* A <code>null context</code> argument will return the original expression.
- *
* @param context The evaluation context
* @return This object's expression result as a <code>String</code>
*/
@@ -466,7 +483,6 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
/** Evaluate this object's expression and return the result as an <code>Object</code>.
* Null or empty expressions return an empty <code>String</code>.
* A <code>null context</code> argument will return the original expression.
- *
* @param context The evaluation context
* @param locale The locale to be used for localization
* @return This object's expression result as a <code>String</code>
@@ -478,7 +494,6 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
/** Evaluate this object's expression and return the result as an <code>Object</code>.
* Null or empty expressions return an empty <code>String</code>.
* A <code>null context</code> argument will return the original expression.
- *
* @param context The evaluation context
* @param timeZone The time zone to be used for localization
* @param locale The locale to be used for localization
@@ -492,14 +507,12 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
}
/** Returns a copy of the original expression.
- *
* @return The original expression
*/
public abstract String getOriginal();
/** Returns <code>true</code> if the original expression is empty
* or <code>null</code>.
- *
* @return <code>true</code> if the original expression is empty
* or <code>null</code>
*/
@@ -507,7 +520,6 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
public abstract boolean isEmpty();
/** Returns a copy of the original expression.
- *
* @return The original expression
*/
@Override
@@ -516,8 +528,22 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
}
protected abstract static class ArrayOffsetString extends FlexibleStringExpander {
- protected final int offset;
- protected final int length;
+ private final int offset;
+ private final int length;
+ /**
+ * Gets length.
+ * @return the length
+ */
+ public int getLength() {
+ return length;
+ }
+ /**
+ * Gets offset.
+ * @return the offset
+ */
+ public int getOffset() {
+ return offset;
+ }
protected ArrayOffsetString(char[] chars, int offset, int length) {
super(chars);
@@ -533,7 +559,7 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
}
@Override
public String getOriginal() {
- return new String(this.chars, this.offset, this.length);
+ return new String(this.getChars(), this.offset, this.length);
}
}
@@ -545,12 +571,12 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
@Override
public boolean isEmpty() {
- return this.chars.length == 0;
+ return this.getChars().length == 0;
}
@Override
public String getOriginal() {
- return new String(this.chars);
+ return new String(this.getChars());
}
@Override
@@ -577,22 +603,23 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
@Override
public String expandString(Map<String, ? extends Object> context, TimeZone timeZone, Locale locale) {
- return new String(this.chars, this.offset, this.length);
+ return new String(this.getChars(), this.getOffset(), this.getLength());
}
}
/** An object that represents a currency portion of an expression. */
protected static class CurrElem extends ArrayOffsetString {
- protected final char[] valueStr;
- protected final FlexibleStringExpander codeExpr;
+ private final char[] valueStr;
+ private final FlexibleStringExpander codeExpr;
protected CurrElem(char[] chars, int offset, int length, int parseStart, int parseLength) {
super(chars, offset, length);
String parse = new String(chars, parseStart, parseLength);
int currencyPos = parse.indexOf("?currency(");
int closeParen = parse.indexOf(")", currencyPos + 10);
- this.codeExpr = FlexibleStringExpander.getInstance(parse, chars, parseStart + currencyPos + 10, closeParen - currencyPos - 10, true);
- this.valueStr = openBracket.concat(parse.substring(0, currencyPos)).concat(closeBracket).toCharArray();
+ this.codeExpr = FlexibleStringExpander.getInstance(parse, chars, parseStart + currencyPos + 10, closeParen - currencyPos - 10,
+ true);
+ this.valueStr = OPEN_BRACKET.concat(parse.substring(0, currencyPos)).concat(CLOSE_BRACKET).toCharArray();
}
@Override
@@ -616,7 +643,7 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
/** A container object that contains expression fragments. */
protected static class Elements extends ArrayOffsetString {
- protected final FlexibleStringExpander[] childElems;
+ private final FlexibleStringExpander[] childElems;
protected Elements(char[] chars, int offset, int length, FlexibleStringExpander[] childElems) {
super(chars, offset, length);
@@ -639,14 +666,14 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
private final int parseStart;
private final int parseLength;
private final String script;
- protected final Class<?> parsedScript;
+ private final Class<?> parsedScript;
protected ScriptElem(char[] chars, int offset, int length, int parseStart, int parseLength) {
super(chars, offset, length);
- this.language = new String(this.chars, offset + 2, parseStart - offset - 3);
+ this.language = new String(this.getChars(), offset + 2, parseStart - offset - 3);
this.parseStart = parseStart;
this.parseLength = parseLength;
- this.script = new String(this.chars, this.parseStart, this.parseLength);
+ this.script = new String(this.getChars(), this.parseStart, this.parseLength);
this.parsedScript = ScriptUtil.parseScript(this.language, this.script);
}
@@ -671,19 +698,19 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
/** An object that represents a nested expression. */
protected static class NestedVarElem extends ArrayOffsetString {
- protected final FlexibleStringExpander[] childElems;
+ private final FlexibleStringExpander[] childElems;
protected NestedVarElem(char[] chars, int offset, int length, int parseStart, int parseLength) {
super(chars, offset, length);
this.childElems = getStrElems(chars, parseStart, parseLength);
- if (length > this.hint) {
- this.hint = length;
+ if (length > this.getHint()) {
+ this.setHint(length);
}
}
@Override
protected Object get(Map<String, ? extends Object> context, TimeZone timeZone, Locale locale) {
- StringBuilder expr = new StringBuilder(this.hint);
+ StringBuilder expr = new StringBuilder(this.getHint());
for (FlexibleStringExpander child : this.childElems) {
expr.append(child.expandString(context, timeZone, locale));
}
@@ -691,7 +718,7 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
return "";
}
try {
- return UelUtil.evaluate(context, openBracket.concat(expr.toString()).concat(closeBracket));
+ return UelUtil.evaluate(context, OPEN_BRACKET.concat(expr.toString()).concat(CLOSE_BRACKET));
} catch (PropertyNotFoundException e) {
if (Debug.verboseOn()) {
Debug.logVerbose("Error evaluating expression: " + e, MODULE);
@@ -705,11 +732,12 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty {
/** An object that represents a simple, non-nested expression. */
protected static class VarElem extends ArrayOffsetString {
- protected final char[] bracketedOriginal;
+ private final char[] bracketedOriginal;
protected VarElem(char[] chars, int offset, int length, int parseStart, int parseLength) {
super(chars, offset, length);
- this.bracketedOriginal = openBracket.concat(UelUtil.prepareExpression(new String(chars, parseStart, parseLength))).concat(closeBracket).toCharArray();
+ this.bracketedOriginal = OPEN_BRACKET.concat(UelUtil.prepareExpression(new String(chars, parseStart, parseLength)))
+ .concat(CLOSE_BRACKET).toCharArray();
}
@Override
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java
index 7768a9b..2d94fdd 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java
@@ -199,7 +199,6 @@ public class UelFunctions {
/**
* Returns a <code>FunctionMapper</code> instance.
- *
* @return <code>FunctionMapper</code> instance
*/
public static FunctionMapper getFunctionMapper() {
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java
index 1cf14d3..92e7bec 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java
@@ -158,7 +158,6 @@ public final class FreeMarkerWorker {
/**
* Provides the sequence of existing {@code freemarkerTransforms.properties} files.
- *
* @return a stream of resource location.
*/
private static Stream<URL> transformsURL(ClassLoader loader) {
@@ -271,7 +270,6 @@ public final class FreeMarkerWorker {
* call this method instead of creating its own <code>Configuration</code> instance. The instance
* returned by this method includes the <code>component://</code> resolver and the OFBiz custom
* transformations.
- *
* @return A <code>Configuration</code> instance.
*/
public static Configuration getDefaultOfbizConfig() {
@@ -538,7 +536,6 @@ public final class FreeMarkerWorker {
* Note that exception is still logged.
* <p>
* This implements the {@link freemarker.template.TemplateExceptionHandler} functional interface.
- *
* @param te the exception that occurred
* @param env the runtime environment of the template
* @param out this is where the output of the template is written
@@ -560,7 +557,6 @@ public final class FreeMarkerWorker {
* Note that exception is still logged.
* <p>
* This implements the {@link freemarker.template.TemplateExceptionHandler} functional interface.
- *
* @param te the exception that occurred
* @param env the runtime environment of the template
* @param out this is where the output of the template is written
diff --git a/framework/base/src/test/java/org/apache/ofbiz/base/util/TimeDurationTests.java b/framework/base/src/test/java/org/apache/ofbiz/base/util/TimeDurationTests.java
index bdd9809..94890c8 100644
--- a/framework/base/src/test/java/org/apache/ofbiz/base/util/TimeDurationTests.java
+++ b/framework/base/src/test/java/org/apache/ofbiz/base/util/TimeDurationTests.java
@@ -55,11 +55,11 @@ public class TimeDurationTests {
TimeDuration.fromNumber(TimeDuration.toLong(duration)));
assertEquals(label + ".isZero", isZero, duration.isZero());
if (isZero) {
- assertEquals(label + ".compareTo(zero) == 0", 0, doCompare(TimeDuration.ZeroTimeDuration, duration));
- assertEquals(label + ".compareTo(zero) == 0", 0, doCompare(duration, TimeDuration.ZeroTimeDuration));
+ assertEquals(label + ".compareTo(zero) == 0", 0, doCompare(TimeDuration.ZERO_TIME_DURATION, duration));
+ assertEquals(label + ".compareTo(zero) == 0", 0, doCompare(duration, TimeDuration.ZERO_TIME_DURATION));
} else {
- assertNotSame(label + ".compareTo(zero) != 0", 0, doCompare(TimeDuration.ZeroTimeDuration, duration));
- assertNotSame(label + ".compareTo(zero) != 0", 0, doCompare(duration, TimeDuration.ZeroTimeDuration));
+ assertNotSame(label + ".compareTo(zero) != 0", 0, doCompare(TimeDuration.ZERO_TIME_DURATION, duration));
+ assertNotSame(label + ".compareTo(zero) != 0", 0, doCompare(duration, TimeDuration.ZERO_TIME_DURATION));
}
}
@@ -161,7 +161,7 @@ public class TimeDurationTests {
@Test
public void testDuration() throws Exception {
Calendar now = Calendar.getInstance();
- TimeDuration zeroDuration = TimeDuration.ZeroTimeDuration;
+ TimeDuration zeroDuration = TimeDuration.ZERO_TIME_DURATION;
assertFalse("zero equals null", zeroDuration.equals(null));
Calendar newTime = (Calendar) now.clone();
zeroDuration.addToCalendar(newTime);
diff --git a/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/MapContextTest.java b/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/MapContextTest.java
index 491831a..c6611df 100644
--- a/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/MapContextTest.java
+++ b/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/MapContextTest.java
@@ -34,10 +34,8 @@ public class MapContextTest {
/**
* A node containing properties and including other nodes.
- *
* This class is simplification of the Controller configuration objects
* useful to test {@code MapContext} objects.
- *
* @see ControllerConfig
*/
static class PNode {
@@ -48,7 +46,6 @@ public class MapContextTest {
/**
* Constructs a node without properties.
- *
* @param includes the included nodes
*/
@SafeVarargs
@@ -58,7 +55,6 @@ public class MapContextTest {
/**
* Constructs a node with some properties.
- *
* @param props the properties of the node
* @param includes the included nodes
*/
@@ -70,7 +66,6 @@ public class MapContextTest {
/**
* Combines the properties of included nodes.
- *
* @return a map context containing the properties of the tree.
*/
public MapContext<String, String> allProps() {
diff --git a/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java b/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java
index 1eb6705..fbacbb7 100644
--- a/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java
+++ b/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java
@@ -249,8 +249,7 @@ public class CatalinaContainer implements Container {
}
virtualHosts.stream()
- .filter(virtualHost -> virtualHost != hostName)
- .forEach(virtualHost -> host.addAlias(virtualHost));
+ .filter(virtualHost -> virtualHost != hostName).forEach(virtualHost -> host.addAlias(virtualHost));
return host;
}
@@ -426,24 +425,24 @@ public class CatalinaContainer implements Container {
Debug.logInfo("Tomcat " + connector + ": enabled HTTP/2", MODULE);
}
connectorProp.properties().values().stream()
- .filter(prop -> {
- String name = prop.name();
- return !"protocol".equals(name) && !"upgradeProtocol".equals(name) && !"port".equals(name);
- })
- .forEach(prop -> {
- String name = prop.name();
- String value = prop.value();
- if (IntrospectionUtils.setProperty(connector, name, value)) {
- if (name.indexOf("Pass") != -1) {
- // this property may be a password, do not include its value in the logs
- Debug.logInfo("Tomcat " + connector + ": set " + name, MODULE);
+ .filter(prop -> {
+ String name = prop.name();
+ return !"protocol".equals(name) && !"upgradeProtocol".equals(name) && !"port".equals(name);
+ })
+ .forEach(prop -> {
+ String name = prop.name();
+ String value = prop.value();
+ if (IntrospectionUtils.setProperty(connector, name, value)) {
+ if (name.indexOf("Pass") != -1) {
+ // this property may be a password, do not include its value in the logs
+ Debug.logInfo("Tomcat " + connector + ": set " + name, MODULE);
+ } else {
+ Debug.logInfo("Tomcat " + connector + ": set " + name + "=" + value, MODULE);
+ }
} else {
- Debug.logInfo("Tomcat " + connector + ": set " + name + "=" + value, MODULE);
+ Debug.logWarning("Tomcat " + connector + ": ignored parameter " + name, MODULE);
}
- } else {
- Debug.logWarning("Tomcat " + connector + ": ignored parameter " + name, MODULE);
- }
- });
+ });
return connector;
}
@@ -461,7 +460,7 @@ public class CatalinaContainer implements Container {
for (ComponentConfig.WebappInfo appInfo: webResourceInfos) {
if (webappsMounts.removeAll(getWebappMounts(appInfo))) {
// webapp is not yet loaded
- if (!appInfo.location.isEmpty()) {
+ if (!appInfo.getLocation().isEmpty()) {
futures.add(executor.submit(createCallableContext(tomcat, appInfo, clusterProp, configuration)));
}
} else {
@@ -478,7 +477,7 @@ public class CatalinaContainer implements Container {
private static List<String> getWebappMounts(ComponentConfig.WebappInfo webappInfo) {
List<String> allAppsMounts = new ArrayList<>();
- String engineName = webappInfo.server;
+ String engineName = webappInfo.getServer();
String mount = webappInfo.getContextRoot();
List<String> virtualHosts = webappInfo.getVirtualHosts();
if (virtualHosts.isEmpty()) {
@@ -492,7 +491,7 @@ public class CatalinaContainer implements Container {
private static Callable<Context> createCallableContext(Tomcat tomcat, ComponentConfig.WebappInfo appInfo,
Configuration.Property clusterProp, ContainerConfig.Configuration configuration) {
- Debug.logInfo("Creating context [" + appInfo.name + "]", MODULE);
+ Debug.logInfo("Creating context [" + appInfo.getName() + "]", MODULE);
Host host = prepareHost(tomcat, appInfo.getVirtualHosts());
return () -> {
@@ -514,7 +513,7 @@ public class CatalinaContainer implements Container {
context.setParent(host);
context.setDocBase(location);
- context.setDisplayName(appInfo.name);
+ context.setDisplayName(appInfo.getName());
context.setPath(getWebappMountPoint(appInfo));
context.addLifecycleListener(new ContextConfig());
context.setJ2EEApplication("OFBiz");
@@ -524,9 +523,9 @@ public class CatalinaContainer implements Container {
context.setReloadable(ContainerConfig.getPropertyValue(configuration, "apps-context-reloadable", false));
context.setDistributable(contextIsDistributable);
context.setCrossContext(ContainerConfig.getPropertyValue(configuration, "apps-cross-context", true));
- context.setPrivileged(appInfo.privileged);
- context.getServletContext().setAttribute("_serverId", appInfo.server);
- context.getServletContext().setAttribute("componentName", appInfo.componentConfig.getComponentName());
+ context.setPrivileged(appInfo.isPrivileged());
+ context.getServletContext().setAttribute("_serverId", appInfo.getServer());
+ context.getServletContext().setAttribute("componentName", appInfo.getComponentConfig().getComponentName());
if (clusterProp != null && contextIsDistributable) {
context.setManager(prepareClusterManager(clusterProp));
@@ -564,14 +563,14 @@ public class CatalinaContainer implements Container {
}
private static String getWebappRootLocation(ComponentConfig.WebappInfo appInfo) {
- return appInfo.componentConfig.rootLocation()
- .resolve(appInfo.location.replace('\\', '/'))
+ return appInfo.getComponentConfig().rootLocation()
+ .resolve(appInfo.getLocation().replace('\\', '/'))
.normalize()
.toString();
}
private static String getWebappMountPoint(ComponentConfig.WebappInfo appInfo) {
- String mount = appInfo.mountPoint;
+ String mount = appInfo.getMountPoint();
if (mount.endsWith("/*")) {
mount = mount.substring(0, mount.length() - 2);
}
diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/CommonWorkers.java b/framework/common/src/main/java/org/apache/ofbiz/common/CommonWorkers.java
index 28b494e..0335816 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/CommonWorkers.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/CommonWorkers.java
@@ -164,7 +164,6 @@ public final class CommonWorkers {
/**
* A generic method to be used on Type enities, e.g. ProductType. Recurse to the root level in the type hierarchy
* and checks if the specified type childType has parentType as its parent somewhere in the hierarchy.
- *
* @param delegator The Delegator object.
* @param entityName Name of the Type entity on which check is performed.
* @param primaryKey Primary Key field of the Type entity.
@@ -172,7 +171,6 @@ public final class CommonWorkers {
* @param parentTypeField Field in Type entity which stores the parent type.
* @param parentType Value of the parent type against which check is performed.
* @return boolean value based on the check results.
- *
* @deprecated Moved to {@link org.apache.ofbiz.entity.util.EntityTypeUtil#hasParentType(Delegator, String, String, String, String, String) EntityTypeUtil}
*/
@Deprecated
diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java b/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java
index 65c08b8..6445e79 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java
@@ -91,7 +91,6 @@ public class FindServices {
/**
* prepareField, analyse inputFields to created normalizedFields a map with field name and operator.
- *
* This is use to the generic method that expects entity data affixed with special suffixes
* to indicate their purpose in formulating an SQL query statement.
* @param inputFields Input parameters run thru UtilHttp.getParameterMap
@@ -206,7 +205,6 @@ public class FindServices {
/**
* Parses input parameters and returns an <code>EntityCondition</code> list.
- *
* @param parameters
* @param fieldList
* @param queryStringMap
@@ -315,7 +313,6 @@ public class FindServices {
/**
* Creates a single <code>EntityCondition</code> based on a set of parameters.
- *
* @param modelField
* @param operation
* @param fieldValue
@@ -394,7 +391,6 @@ public class FindServices {
/**
* createCondition, comparing the normalizedFields with the list of keys, .
- *
* This is use to the generic method that expects entity data affixed with special suffixes
* to indicate their purpose in formulating an SQL query statement.
* @param modelEntity the model entity object
@@ -451,13 +447,11 @@ public class FindServices {
}
/**
- *
* same as performFind but now returning a list instead of an iterator
* Extra parameters viewIndex: startPage of the partial list (0 = first page)
* viewSize: the length of the page (number of records)
* Extra output parameter: listSize: size of the totallist
* list : the list itself.
- *
* @param dctx
* @param context
* @return Map
@@ -494,7 +488,6 @@ public class FindServices {
/**
* performFind
- *
* This is a generic method that expects entity data affixed with special suffixes
* to indicate their purpose in formulating an SQL query statement.
*/
@@ -581,7 +574,6 @@ public class FindServices {
/**
* prepareFind
- *
* This is a generic method that expects entity data affixed with special suffixes
* to indicate their purpose in formulating an SQL query statement.
*/
@@ -662,7 +654,6 @@ public class FindServices {
/**
* executeFind
- *
* This is a generic method that returns an EntityListIterator.
*/
public static Map<String, Object> executeFind(DispatchContext dctx, Map<String, ?> context) {
@@ -787,7 +778,6 @@ public class FindServices {
/**
* Returns the first generic item of the service 'performFind'
* Same parameters as performFind service but returns a single GenericValue
- *
* @param dctx
* @param context
* @return returns the first item
diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/authentication/AuthenticationComparator.java b/framework/common/src/main/java/org/apache/ofbiz/common/authentication/AuthenticationComparator.java
index ceb79f7..2a141a0 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/authentication/AuthenticationComparator.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/authentication/AuthenticationComparator.java
@@ -52,7 +52,6 @@ public class AuthenticationComparator implements Comparator<Authenticator> {
* any comparator that violates this condition should clearly indicate
* this fact. The recommended language is "Note: this comparator
* imposes orderings that are inconsistent with equals."
- *
* @param a1 the first object to be compared.
* @param a2 the second object to be compared.
* @return a negative integer, zero, or a positive integer as the
diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/authentication/api/AuthenticatorException.java b/framework/common/src/main/java/org/apache/ofbiz/common/authentication/api/AuthenticatorException.java
index 4fef745..1b8b79f 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/authentication/api/AuthenticatorException.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/authentication/api/AuthenticatorException.java
@@ -39,7 +39,6 @@ public class AuthenticatorException extends GeneralException {
/**
* Constructs an <code>GeneralException</code> with the specified detail message.
- *
* @param msg the detail message.
*/
public AuthenticatorException(String msg) {
@@ -48,7 +47,6 @@ public class AuthenticatorException extends GeneralException {
/**
* Constructs an <code>GeneralException</code> with the specified detail message and nested Exception.
- *
* @param msg the detail message.
* @param nested the nested exception.
*/
@@ -58,7 +56,6 @@ public class AuthenticatorException extends GeneralException {
/**
* Constructs an <code>GeneralException</code> with the specified detail message and nested Exception.
- *
* @param nested the nested exception.
*/
public AuthenticatorException(Throwable nested) {
@@ -67,7 +64,6 @@ public class AuthenticatorException extends GeneralException {
/**
* Constructs an <code>GeneralException</code> with the specified detail message, list and nested Exception.
- *
* @param msg the detail message.
* @param messages error message list.
*/
@@ -77,7 +73,6 @@ public class AuthenticatorException extends GeneralException {
/**
* Constructs an <code>GeneralException</code> with the specified detail message, list and nested Exception.
- *
* @param msg the detail message.
* @param messages error message list.
* @param nested the nested exception
@@ -88,7 +83,6 @@ public class AuthenticatorException extends GeneralException {
/**
* Constructs an <code>GeneralException</code> with the specified detail message list and nested Exception.
- *
* @param messages error message list.
* @param nested the nested exception.
*/
diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/authentication/example/TestFailAuthenticator.java b/framework/common/src/main/java/org/apache/ofbiz/common/authentication/example/TestFailAuthenticator.java
index 61e42d8..82fadcc 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/authentication/example/TestFailAuthenticator.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/authentication/example/TestFailAuthenticator.java
@@ -38,7 +38,6 @@ public class TestFailAuthenticator implements Authenticator {
/**
* Method called when authenticator is first initialized (the delegator
* object can be obtained from the LocalDispatcher)
- *
* @param dispatcher The LocalDispatcher to use for this Authenticator
*/
@Override
@@ -50,7 +49,6 @@ public class TestFailAuthenticator implements Authenticator {
/**
* Method to authenticate a user
- *
* @param username User's username
* @param password User's password
* @param isServiceAuth true if authentication is for a service call
@@ -66,7 +64,6 @@ public class TestFailAuthenticator implements Authenticator {
/**
* Logs a user out
- *
* @param username User's username
* @throws org.apache.ofbiz.common.authentication.api.AuthenticatorException
* when logout fails
@@ -78,7 +75,6 @@ public class TestFailAuthenticator implements Authenticator {
/**
* Reads user information and syncs it to OFBiz (i.e. UserLogin, Person, etc)
- *
* @param username User's username
* @throws org.apache.ofbiz.common.authentication.api.AuthenticatorException
* user synchronization fails
@@ -91,7 +87,6 @@ public class TestFailAuthenticator implements Authenticator {
/**
* Updates a user's password
- *
* @param username User's username
* @param password User's current password
* @param newPassword User's new password
@@ -105,7 +100,6 @@ public class TestFailAuthenticator implements Authenticator {
/**
* Weight of this authenticator (lower weights are run first)
- *
* @return the weight of this Authenticator
*/
@Override
@@ -115,7 +109,6 @@ public class TestFailAuthenticator implements Authenticator {
/**
* Is the user synchronized back to OFBiz
- *
* @return true if the user record is copied to the OFB database
*/
@Override
@@ -126,7 +119,6 @@ public class TestFailAuthenticator implements Authenticator {
/**
* Is this expected to be the only authenticator, if so errors will be thrown when users cannot be found
- *
* @return true if this is expected to be the only Authenticator
*/
@Override
@@ -137,7 +129,6 @@ public class TestFailAuthenticator implements Authenticator {
/**
* Flag to test if this Authenticator is enabled
- *
* @return true if the Authenticator is enabled
*/
@Override
diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/authentication/example/TestPassAuthenticator.java b/framework/common/src/main/java/org/apache/ofbiz/common/authentication/example/TestPassAuthenticator.java
index 99262ee..4f794fe 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/authentication/example/TestPassAuthenticator.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/authentication/example/TestPassAuthenticator.java
@@ -31,7 +31,6 @@ public class TestPassAuthenticator extends TestFailAuthenticator {
/**
* Method to authenticate a user
- *
* @param username User's username
* @param password User's password
* @param isServiceAuth true if authentication is for a service call
@@ -47,7 +46,6 @@ public class TestPassAuthenticator extends TestFailAuthenticator {
/**
* Flag to test if this Authenticator is enabled
- *
* @return true if the Authenticator is enabled
*/
@Override
diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/email/NotificationServices.java b/framework/common/src/main/java/org/apache/ofbiz/common/email/NotificationServices.java
index 981ee4b..cb0e47c 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/email/NotificationServices.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/email/NotificationServices.java
@@ -113,7 +113,6 @@ public class NotificationServices {
* specified body instead. This can be used to combine both service
* calls in a decoupled manner if other steps are required between
* generating the message body and sending the notification.
- *
* @param ctx The dispatching context of the service
* @param context The map containing all the fields associated with
* the sevice
@@ -178,7 +177,6 @@ public class NotificationServices {
* The result returned will contain the appropriate response
* messages indicating success or failure and the OUT parameter,
* "body" containing the generated message.
- *
* @param ctx The dispatching context of the service
* @param context The map containing all the fields associated with
* the sevice
@@ -247,7 +245,6 @@ public class NotificationServices {
* such as the <code>baseUrl</code>, perhaps using the standard
* <code>ResourceBundle</code> java approach so that both classes
* and static files may be invoked.
- *
* @param context The context to check and, if necessary, set the
* <code>baseUrl</code>.
*/
diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/image/ImageTransform.java b/framework/common/src/main/java/org/apache/ofbiz/common/image/ImageTransform.java
index 5d5a1ba..fc68c9b 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/image/ImageTransform.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/image/ImageTransform.java
@@ -60,7 +60,6 @@ public class ImageTransform {
* getBufferedImage
* <p>
* Set a buffered image
- *
* @param fileLocation Full file Path or URL
* @return URL images for all different size types
* @throws IOException Error prevents the document from being fully parsed
@@ -98,7 +97,6 @@ public class ImageTransform {
* scaleImage
* <p>
* scale original image related to the ImageProperties.xml dimensions
- *
* @param bufImg Buffered image to scale
* @param imgHeight Original image height
* @param imgWidth Original image width
@@ -208,7 +206,6 @@ public class ImageTransform {
* getXMLValue
* <p>
* From a XML element, get a values map
- *
* @param fileFullPath File path to parse
* @return Map contains asked attribute values by attribute name
*/
@@ -273,7 +270,6 @@ public class ImageTransform {
* toBufferedImage
* <p>
* Transform from an Image instance to a BufferedImage instance
- *
* @param image Source image
* @return BufferedImage
*/
diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java b/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java
index fbc9ed6..8ff7336 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java
@@ -449,7 +449,6 @@ public class LoginServices {
/**
* Login service to authenticate a username without password, storing history
- *
* @return Map of results including (userLogin) GenericValue object
*/
public static Map<String, Object> userImpersonate(DispatchContext ctx, Map<String, ?> context) {
@@ -522,7 +521,6 @@ public class LoginServices {
/**
* Return error message if a needed control has failed : userLoginToImpersonate must exist Impersonation have to be enabled Check
* userLoginIdToImpersonate is active, not Admin and not equals to userLogin Check userLogin has enough permission
- *
* @param delegator
* @param userLogin
* @param userLoginToImpersonate
diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/preferences/PreferenceWorker.java b/framework/common/src/main/java/org/apache/ofbiz/common/preferences/PreferenceWorker.java
index 9e98a90..52b517a 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/preferences/PreferenceWorker.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/preferences/PreferenceWorker.java
@@ -158,7 +158,6 @@ public final class PreferenceWorker {
* found, the method attempts to get the current user's userLoginId. If the user
* isn't logged in, then the method returns <a href="#DEFAULT_UID">DEFAULT_UID</a>
* if returnDefault is set to true, otherwise the method returns a null or empty string.</p>
- *
* @param context Map containing the input arguments.
* @param returnDefault return <a href="#DEFAULT_UID">DEFAULT_UID</a> if no userLoginId is found.
* @return userLoginId String
@@ -190,7 +189,6 @@ public final class PreferenceWorker {
* If the user has the <a href="#ADMIN_PERMISSION">ADMIN_PERMISSION</a> permission then the
* method returns true.</li>
* </ul>
- *
* @param ctx The DispatchContext that this service is operating in.
* @param context Map containing the input arguments.
* @return true if the userLoginId arguments are valid
diff --git a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile.java b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile.java
index 2c9dcc8..4b21708 100644
--- a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile.java
+++ b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile.java
@@ -171,7 +171,6 @@ public class DataFile {
/**
* Writes the records in this DataFile object to a text data file
- *
* @param filename
* The filename to put the data into
* @throws DataFileException
diff --git a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile2EntityXml.java b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile2EntityXml.java
index 5dd7c94..b8b2baa 100644
--- a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile2EntityXml.java
+++ b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile2EntityXml.java
@@ -56,26 +56,26 @@ public class DataFile2EntityXml {
outFile.newLine();
for (Record record : dataFile.getRecords()) {
ModelRecord modelRecord = record.getModelRecord();
- outFile.write("<" + modelRecord.name + " ");
- for (ModelField modelField : modelRecord.fields) {
- if (modelField.ignored) {
+ outFile.write("<" + modelRecord.getName() + " ");
+ for (ModelField modelField : modelRecord.getFields()) {
+ if (modelField.isIgnored()) {
continue;
}
- Object value = record.get(modelField.name);
+ Object value = record.get(modelField.getName());
if (value == null) {
- value = modelField.defaultValue;
+ value = modelField.getDefaultValue();
}
if (value instanceof String) {
value = ((String) value).trim();
if (((String) value).length() == 0) {
- value = modelField.defaultValue;
+ value = modelField.getDefaultValue();
}
}
if (value != null) {
if (value instanceof String) {
- outFile.write(modelField.name + "=\"" + UtilFormatOut.encodeXmlValue((String) value) + "\" ");
+ outFile.write(modelField.getName() + "=\"" + UtilFormatOut.encodeXmlValue((String) value) + "\" ");
} else {
- outFile.write(modelField.name + "=\"" + value + "\" ");
+ outFile.write(modelField.getName() + "=\"" + value + "\" ");
}
}
}
@@ -95,7 +95,8 @@ public class DataFile2EntityXml {
String definitionLoc = args[1];
String definitionName = args[2];
- try (BufferedWriter outFile = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(dataFileLoc + ".xml"), StandardCharsets.UTF_8));) {
+ try (BufferedWriter outFile = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(dataFileLoc + ".xml"),
+ StandardCharsets.UTF_8));) {
URL dataFileUrl = UtilURL.fromFilename(dataFileLoc);
URL definitionUrl = UtilURL.fromFilename(definitionLoc);
@@ -111,14 +112,14 @@ public class DataFile2EntityXml {
if (dataFile != null) {
for (Record record : dataFile.getRecords()) {
ModelRecord modelRecord = record.getModelRecord();
- outFile.write("<" + modelRecord.name + " ");
- for (ModelField modelField : modelRecord.fields) {
- Object value = record.get(modelField.name);
+ outFile.write("<" + modelRecord.getName() + " ");
+ for (ModelField modelField : modelRecord.getFields()) {
+ Object value = record.get(modelField.getName());
if (value instanceof String) {
value = ((String) value).trim();
- outFile.write(modelField.name + "=\"" + UtilFormatOut.encodeXmlValue((String) value) + "\" ");
+ outFile.write(modelField.getName() + "=\"" + UtilFormatOut.encodeXmlValue((String) value) + "\" ");
} else {
- outFile.write(modelField.name + "=\"" + value + "\" ");
+ outFile.write(modelField.getName() + "=\"" + value + "\" ");
}
}
outFile.write("/>");
diff --git a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/ModelDataFile.java b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/ModelDataFile.java
index 7d3fb13..8c647e6 100644
--- a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/ModelDataFile.java
+++ b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/ModelDataFile.java
@@ -34,36 +34,52 @@ public class ModelDataFile {
public static final String SEP_DELIMITED = "delimited";
/** The name of the File */
- public String name = "";
+ private String name = "";
/** The type code of the File, ususally contained somewhere in the file and can be used to identify it */
- public String typeCode = "";
+ private String typeCode = "";
/** The entity that generally sends the file */
- public String sender = "";
+ private String sender = "";
/** The entity that generally receives the file */
- public String receiver = "";
+ private String receiver = "";
/** The length in bytes of a single record, ONLY if it uses fixed length records */
- public int recordLength = -1;
+ private int recordLength = -1;
/** Start the file read at line */
- public int startLine = 0;
+ private int startLine = 0;
/** The delimiter used in the file, if delimiter separated fields are used */
- public char delimiter = '|';
+ private char delimiter = '|';
+
+ /**
+ * Gets text delimiter.
+ * @return the text delimiter
+ */
+ public String getTextDelimiter() {
+ return textDelimiter;
+ }
+
+ /**
+ * Sets text delimiter.
+ * @param textDelimiter the text delimiter
+ */
+ public void setTextDelimiter(String textDelimiter) {
+ this.textDelimiter = textDelimiter;
+ }
/** The text delimiter, like quots, used in the file, if delimiter separated fields are used */
- public String textDelimiter = null;
+ private String textDelimiter = null;
/** The field serparator style, either fixed-length, or delimited */
- public String separatorStyle = "";
+ private String separatorStyle = "";
/** A free form description of the file */
- public String description = "";
+ private String description = "";
/** file enconding, by default UTF-8 is used */
- public String encodingType = "UTF-8";
+ private String encodingType = "UTF-8";
/**
* the End Of Line type (CRLF or CR)
@@ -71,109 +87,211 @@ public class ModelDataFile {
private String eolType = null;
/** List of record definitions for the file */
- public List<ModelRecord> records = new ArrayList<>();
+ private List<ModelRecord> records = new ArrayList<>();
+ /**
+ * Gets model record.
+ * @param recordName the record name
+ * @return the model record
+ */
public ModelRecord getModelRecord(String recordName) {
for (ModelRecord curRecord: records) {
- if (curRecord.name.equals(recordName)) {
+ if (curRecord.getName().equals(recordName)) {
return curRecord;
}
}
return null;
}
+ /**
+ * Gets name.
+ * @return the name
+ */
public String getName() {
return name;
}
+ /**
+ * Sets name.
+ * @param name the name
+ */
public void setName(String name) {
this.name = name;
}
+ /**
+ * Gets type code.
+ * @return the type code
+ */
public String getTypeCode() {
return typeCode;
}
+ /**
+ * Sets type code.
+ * @param typeCode the type code
+ */
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
+ /**
+ * Gets sender.
+ * @return the sender
+ */
public String getSender() {
return sender;
}
+ /**
+ * Sets sender.
+ * @param sender the sender
+ */
public void setSender(String sender) {
this.sender = sender;
}
+ /**
+ * Gets receiver.
+ * @return the receiver
+ */
public String getReceiver() {
return receiver;
}
+ /**
+ * Sets receiver.
+ * @param receiver the receiver
+ */
public void setReceiver(String receiver) {
this.receiver = receiver;
}
+ /**
+ * Gets record length.
+ * @return the record length
+ */
public int getRecordLength() {
return recordLength;
}
+ /**
+ * Sets record length.
+ * @param recordLength the record length
+ */
public void setRecordLength(int recordLength) {
this.recordLength = recordLength;
}
+ /**
+ * Gets delimiter.
+ * @return the delimiter
+ */
public char getDelimiter() {
return delimiter;
}
+ /**
+ * Sets delimiter.
+ * @param delimiter the delimiter
+ */
public void setDelimiter(char delimiter) {
this.delimiter = delimiter;
}
+ /**
+ * Gets start line.
+ * @return the start line
+ */
public int getStartLine() {
return startLine;
}
+ /**
+ * Sets start line.
+ * @param startLine the start line
+ */
public void setStartLine(int startLine) {
this.startLine = startLine;
}
+ /**
+ * Gets separator style.
+ * @return the separator style
+ */
public String getSeparatorStyle() {
return separatorStyle;
}
+ /**
+ * Sets separator style.
+ * @param separatorStyle the separator style
+ */
public void setSeparatorStyle(String separatorStyle) {
this.separatorStyle = separatorStyle;
}
+ /**
+ * Gets description.
+ * @return the description
+ */
public String getDescription() {
return description;
}
+ /**
+ * Sets description.
+ * @param description the description
+ */
public void setDescription(String description) {
this.description = description;
}
+ /**
+ * Gets eol type.
+ * @return the eol type
+ */
public String getEOLType() {
return eolType;
}
+ /**
+ * Sets eol type.
+ * @param eolType the eol type
+ */
public void setEOLType(String eolType) {
this.eolType = eolType;
}
+ /**
+ * Gets records.
+ * @return the records
+ */
public List<ModelRecord> getRecords() {
return records;
}
+ /**
+ * Sets records.
+ * @param records the records
+ */
public void setRecords(List<ModelRecord> records) {
this.records = records;
}
+
+ /**
+ * Gets encoding type.
+ * @return the encoding type
+ */
public String getEncodingType() {
return encodingType;
}
+ /**
+ * Sets encoding type.
+ * @param encodingType the encoding type
+ */
public void setEncodingType(String encodingType) {
this.encodingType = encodingType;
}
diff --git a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/ModelDataFileReader.java b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/ModelDataFileReader.java
index 745bf84..f513ff1 100644
--- a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/ModelDataFileReader.java
+++ b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/ModelDataFileReader.java
@@ -41,16 +41,16 @@ import org.w3c.dom.NodeList;
public final class ModelDataFileReader {
private static final String MODULE = ModelDataFileReader.class.getName();
- private static final UtilCache<URL, ModelDataFileReader> readers = UtilCache.createUtilCache("ModelDataFile", true);
+ private static final UtilCache<URL, ModelDataFileReader> READERS = UtilCache.createUtilCache("ModelDataFile", true);
public static ModelDataFileReader getModelDataFileReader(URL readerURL) throws DataFileException {
- ModelDataFileReader reader = readers.get(readerURL);
+ ModelDataFileReader reader = READERS.get(readerURL);
if (reader == null) {
if (Debug.infoOn()) {
Debug.logInfo("[ModelDataFileReader.getModelDataFileReader] : creating reader for " + readerURL, MODULE);
}
reader = new ModelDataFileReader(readerURL);
- readers.putIfAbsent(readerURL, reader);
+ READERS.putIfAbsent(readerURL, reader);
}
if (Debug.infoOn()) {
Debug.logInfo("[ModelDataFileReader.getModelDataFileReader] : returning reader for " + readerURL, MODULE);
@@ -70,28 +70,28 @@ public final class ModelDataFileReader {
ModelDataFile dataFile = new ModelDataFile();
String tempStr;
- dataFile.name = UtilXml.checkEmpty(dataFileElement.getAttribute("name"));
- dataFile.typeCode = UtilXml.checkEmpty(dataFileElement.getAttribute("type-code"));
- dataFile.sender = UtilXml.checkEmpty(dataFileElement.getAttribute("sender"));
- dataFile.receiver = UtilXml.checkEmpty(dataFileElement.getAttribute("receiver"));
+ dataFile.setName(UtilXml.checkEmpty(dataFileElement.getAttribute("name")));
+ dataFile.setTypeCode(UtilXml.checkEmpty(dataFileElement.getAttribute("type-code")));
+ dataFile.setSender(UtilXml.checkEmpty(dataFileElement.getAttribute("sender")));
+ dataFile.setReceiver(UtilXml.checkEmpty(dataFileElement.getAttribute("receiver")));
dataFile.setEncodingType(UtilXml.checkEmpty(dataFileElement.getAttribute("encoding-type")));
tempStr = UtilXml.checkEmpty(dataFileElement.getAttribute("record-length"));
if (UtilValidate.isNotEmpty(tempStr)) {
- dataFile.recordLength = Integer.parseInt(tempStr);
+ dataFile.setRecordLength(Integer.parseInt(tempStr));
}
tempStr = UtilXml.checkEmpty(dataFileElement.getAttribute("delimiter"));
if (tempStr != null && tempStr.length() == 1) {
- dataFile.delimiter = tempStr.charAt(0);
+ dataFile.setDelimiter(tempStr.charAt(0));
}
tempStr = dataFileElement.getAttribute("start-line");
if (tempStr != null) {
- dataFile.startLine = Integer.valueOf(tempStr);
+ dataFile.setStartLine(Integer.valueOf(tempStr));
}
tempStr = UtilXml.checkEmpty(dataFileElement.getAttribute("text-delimiter"));
if (UtilValidate.isNotEmpty(tempStr)) {
- dataFile.textDelimiter = tempStr;
+ dataFile.setTextDelimiter(tempStr);
}
tempStr = UtilXml.checkEmpty(dataFileElement.getAttribute("eol-type"));
@@ -99,27 +99,28 @@ public final class ModelDataFileReader {
dataFile.setEOLType(tempStr);
}
- dataFile.separatorStyle = UtilXml.checkEmpty(dataFileElement.getAttribute("separator-style"));
- dataFile.description = UtilXml.checkEmpty(dataFileElement.getAttribute("description"));
+ dataFile.setSeparatorStyle(UtilXml.checkEmpty(dataFileElement.getAttribute("separator-style")));
+ dataFile.setDescription(UtilXml.checkEmpty(dataFileElement.getAttribute("description")));
NodeList rList = dataFileElement.getElementsByTagName("record");
for (int i = 0; i < rList.getLength(); i++) {
Element recordElement = (Element) rList.item(i);
ModelRecord modelRecord = createModelRecord(recordElement);
- dataFile.records.add(modelRecord);
+ dataFile.getRecords().add(modelRecord);
}
- for (ModelRecord modelRecord : dataFile.records) {
+ for (ModelRecord modelRecord : dataFile.getRecords()) {
- if (modelRecord.parentName.length() > 0) {
- ModelRecord parentRecord = dataFile.getModelRecord(modelRecord.parentName);
+ if (modelRecord.getParentName().length() > 0) {
+ ModelRecord parentRecord = dataFile.getModelRecord(modelRecord.getParentName());
if (parentRecord != null) {
- parentRecord.childRecords.add(modelRecord);
- modelRecord.parentRecord = parentRecord;
+ parentRecord.getChildRecords().add(modelRecord);
+ modelRecord.setParentRecord(parentRecord);
} else {
- Debug.logError("[ModelDataFileReader.createModelDataFile] ERROR: Could not find parentRecord with name " + modelRecord.parentName, MODULE);
+ Debug.logError("[ModelDataFileReader.createModelDataFile] ERROR: Could not find parentRecord with name "
+ + modelRecord.getParentName(), MODULE);
}
}
}
@@ -153,7 +154,8 @@ public final class ModelDataFileReader {
for (Element curDataFile : dataFileElements) {
String dataFileName = UtilXml.checkEmpty(curDataFile.getAttribute("name"));
if (result.containsKey(dataFileName)) {
- Debug.logWarning("DataFile " + dataFileName + " is defined more than once, most recent will over-write previous definition(s)", MODULE);
+ Debug.logWarning("DataFile " + dataFileName + " is defined more than once, most recent will over-write previous definition(s)",
+ MODULE);
}
ModelDataFile dataFile = createModelDataFile(curDataFile);
result.put(dataFileName, dataFile);
@@ -168,37 +170,37 @@ public final class ModelDataFileReader {
ModelField field = new ModelField();
String tempStr;
- field.name = UtilXml.checkEmpty(fieldElement.getAttribute("name"));
+ field.setName(UtilXml.checkEmpty(fieldElement.getAttribute("name")));
tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("position"));
if (UtilValidate.isNotEmpty(tempStr)) {
- field.position = Integer.parseInt(tempStr);
+ field.setPosition(Integer.parseInt(tempStr));
}
tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("length"));
if (UtilValidate.isNotEmpty(tempStr)) {
- field.length = Integer.parseInt(tempStr);
+ field.setLength(Integer.parseInt(tempStr));
}
- field.type = UtilXml.checkEmpty(fieldElement.getAttribute("type"));
- field.format = UtilXml.checkEmpty(fieldElement.getAttribute("format"));
- field.validExp = UtilXml.checkEmpty(fieldElement.getAttribute("valid-exp"));
- field.description = UtilXml.checkEmpty(fieldElement.getAttribute("description"));
- field.defaultValue = UtilXml.checkEmpty(fieldElement.getAttribute("default-value"));
- field.refField = UtilXml.checkEmpty(fieldElement.getAttribute("ref-field"));
+ field.setType(UtilXml.checkEmpty(fieldElement.getAttribute("type")));
+ field.setFormat(UtilXml.checkEmpty(fieldElement.getAttribute("format")));
+ field.setValidExp(UtilXml.checkEmpty(fieldElement.getAttribute("valid-exp")));
+ field.setDescription(UtilXml.checkEmpty(fieldElement.getAttribute("description")));
+ field.setDefaultValue(UtilXml.checkEmpty(fieldElement.getAttribute("default-value")));
+ field.setRefField(UtilXml.checkEmpty(fieldElement.getAttribute("ref-field")));
tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("prim-key"));
if (UtilValidate.isNotEmpty(tempStr)) {
- field.isPk = Boolean.parseBoolean(tempStr);
+ field.setPk(Boolean.parseBoolean(tempStr));
}
tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("ignored"));
if (UtilValidate.isNotEmpty(tempStr)) {
- field.ignored = Boolean.parseBoolean(tempStr);
+ field.setIgnored(Boolean.parseBoolean(tempStr));
}
tempStr = UtilXml.checkEmpty(fieldElement.getAttribute("expression"));
if (UtilValidate.isNotEmpty(tempStr)) {
- field.expression = Boolean.parseBoolean(tempStr);
+ field.setExpression(Boolean.parseBoolean(tempStr));
}
return field;
@@ -208,35 +210,35 @@ public final class ModelDataFileReader {
ModelRecord record = new ModelRecord();
String tempStr;
- record.name = UtilXml.checkEmpty(recordElement.getAttribute("name"));
- record.typeCode = UtilXml.checkEmpty(recordElement.getAttribute("type-code"));
+ record.setName(UtilXml.checkEmpty(recordElement.getAttribute("name")));
+ record.setTypeCode(UtilXml.checkEmpty(recordElement.getAttribute("type-code")));
- record.tcMin = UtilXml.checkEmpty(recordElement.getAttribute("tc-min"));
- if (record.tcMin.length() > 0) {
- record.tcMinNum = Long.parseLong(record.tcMin);
+ record.setTcMin(UtilXml.checkEmpty(recordElement.getAttribute("tc-min")));
+ if (record.getTcMin().length() > 0) {
+ record.setTcMinNum(Long.parseLong(record.getTcMin()));
}
- record.tcMax = UtilXml.checkEmpty(recordElement.getAttribute("tc-max"));
- if (record.tcMax.length() > 0) {
- record.tcMaxNum = Long.parseLong(record.tcMax);
+ record.setTcMax(UtilXml.checkEmpty(recordElement.getAttribute("tc-max")));
+ if (record.getTcMax().length() > 0) {
+ record.setTcMaxNum(Long.parseLong(record.getTcMax()));
}
tempStr = UtilXml.checkEmpty(recordElement.getAttribute("tc-isnum"));
if (UtilValidate.isNotEmpty(tempStr)) {
- record.tcIsNum = Boolean.parseBoolean(tempStr);
+ record.setTcIsNum(Boolean.parseBoolean(tempStr));
}
tempStr = UtilXml.checkEmpty(recordElement.getAttribute("tc-position"));
if (UtilValidate.isNotEmpty(tempStr)) {
- record.tcPosition = Integer.parseInt(tempStr);
+ record.setTcPosition(Integer.parseInt(tempStr));
}
tempStr = UtilXml.checkEmpty(recordElement.getAttribute("tc-length"));
if (UtilValidate.isNotEmpty(tempStr)) {
- record.tcLength = Integer.parseInt(tempStr);
+ record.setTcLength(Integer.parseInt(tempStr));
}
- record.description = UtilXml.checkEmpty(recordElement.getAttribute("description"));
- record.parentName = UtilXml.checkEmpty(recordElement.getAttribute("parent-name"));
- record.limit = UtilXml.checkEmpty(recordElement.getAttribute("limit"));
+ record.setDescription(UtilXml.checkEmpty(recordElement.getAttribute("description")));
+ record.setParentName(UtilXml.checkEmpty(recordElement.getAttribute("parent-name")));
+ record.setLimit(UtilXml.checkEmpty(recordElement.getAttribute("limit")));
NodeList fList = recordElement.getElementsByTagName("field");
int priorEnd = -1;
@@ -246,11 +248,11 @@ public final class ModelDataFileReader {
ModelField modelField = createModelField(fieldElement);
// if the position is not specified, assume the start position based on last entry
- if ((i > 0) && (modelField.position == -1)) {
- modelField.position = priorEnd;
+ if ((i > 0) && (modelField.getPosition() == -1)) {
+ modelField.setPosition(priorEnd);
}
- priorEnd = modelField.position + modelField.length;
- record.fields.add(modelField);
+ priorEnd = modelField.getPosition() + modelField.getLength();
+ record.getFields().add(modelField);
}
return record;
@@ -259,7 +261,6 @@ public final class ModelDataFileReader {
/**
* Creates a Collection with the dataFileName of each DataFile defined in the
* specified XML DataFile Descriptor file.
- *
* @return A Collection of dataFileName Strings
*/
public Collection<String> getDataFileNames() {
@@ -269,7 +270,6 @@ public final class ModelDataFileReader {
/**
* Creates a Iterator with the dataFileName of each DataFile defined in the specified
* XML DataFile Descriptor file.
- *
* @return A Iterator of dataFileName Strings
*/
public Iterator<String> getDataFileNamesIterator() {
@@ -279,7 +279,6 @@ public final class ModelDataFileReader {
/**
* Gets an DataFile object based on a definition from the specified XML DataFile
* descriptor file.
- *
* @param dataFileName
* The dataFileName of the DataFile definition to use.
* @return An DataFile object describing the specified dataFile of the specified
diff --git a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/ModelField.java b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/ModelField.java
index 9405185..0dd6398 100644
--- a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/ModelField.java
+++ b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/ModelField.java
@@ -26,46 +26,206 @@ import java.io.Serializable;
@SuppressWarnings("serial")
public class ModelField implements Serializable {
/** The name of the Field */
- public String name = "";
+ private String name = "";
/** The position of the field in the record - byte number for fixed-length, or field number for delimited */
- public int position = -1;
+ private int position = -1;
/** The length of the Field in bytes, if applicable (mostly for fixed-length) */
- public int length = -1;
+ private int length = -1;
/** The type of the Field */
- public String type = "";
+ private String type = "";
/** The format of the Field */
- public String format = "";
+ private String format = "";
/** The valid-exp of the Field */
- public String validExp = "";
+ private String validExp = "";
/** Free form description of the Field */
- public String description = "";
+ private String description = "";
/** Default value for the Field */
- public Object defaultValue = null;
+ private Object defaultValue = null;
/** boolean which specifies whether or not the Field is a Primary Key */
- public boolean isPk = false;
+ private boolean isPk = false;
/** boolean which specifies whether or not the Field is ignored */
- public boolean ignored = false;
+ private boolean ignored = false;
/** boolean which specifies whether or not the Field is taken from the input file */
- public boolean expression = false;
+ private boolean expression = false;
/** Referenced field */
- public String refField = null;
+ private String refField = null;
+ /**
+ * Gets name.
+ * @return the name
+ */
public String getName() {
return name;
}
+ /**
+ * Sets name.
+ * @param name the name
+ */
public void setName(String name) {
this.name = name;
}
+
+ /**
+ * Gets position.
+ * @return the position
+ */
+ public int getPosition() {
+ return position;
+ }
+
+ /**
+ * Gets length.
+ * @return the length
+ */
+ public int getLength() {
+ return length;
+ }
+
+ /**
+ * Sets position.
+ * @param position the position
+ */
+ public void setPosition(int position) {
+ this.position = position;
+ }
+
+ /**
+ * Sets length.
+ * @param length the length
+ */
+ public void setLength(int length) {
+ this.length = length;
+ }
+
+ /**
+ * Sets type.
+ * @param type the type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Gets type.
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Sets format.
+ * @param format the format
+ */
+ public void setFormat(String format) {
+ this.format = format;
+ }
+
+ /**
+ * Gets format.
+ * @return the format
+ */
+ public String getFormat() {
+ return format;
+ }
+
+ /**
+ * Sets valid exp.
+ * @param validExp the valid exp
+ */
+ public void setValidExp(String validExp) {
+ this.validExp = validExp;
+ }
+
+ /**
+ * Sets description.
+ * @param description the description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets default value.
+ * @param defaultValue the default value
+ */
+ public void setDefaultValue(Object defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ /**
+ * Sets pk.
+ * @param pk the pk
+ */
+ public void setPk(boolean pk) {
+ isPk = pk;
+ }
+
+ /**
+ * Sets ignored.
+ * @param ignored the ignored
+ */
+ public void setIgnored(boolean ignored) {
+ this.ignored = ignored;
+ }
+
+ /**
+ * Sets expression.
+ * @param expression the expression
+ */
+ public void setExpression(boolean expression) {
+ this.expression = expression;
+ }
+
+ /**
+ * Sets ref field.
+ * @param refField the ref field
+ */
+ public void setRefField(String refField) {
+ this.refField = refField;
+ }
+
+ /**
+ * Gets default value.
+ * @return the default value
+ */
+ public Object getDefaultValue() {
+ return defaultValue;
+ }
+
+ /**
+ * Is expression boolean.
+ * @return the boolean
+ */
+ public boolean isExpression() {
+ return expression;
+ }
+
+ /**
+ * Gets ref field.
+ * @return the ref field
+ */
+ public String getRefField() {
+ return refField;
+ }
+
+ /**
+ * Is ignored boolean.
+ * @return the boolean
+ */
+ public boolean isIgnored() {
+ return ignored;
+ }
}
diff --git a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/ModelRecord.java b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/ModelRecord.java
index fcb20b2..e33fc34 100644
--- a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/ModelRecord.java
+++ b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/ModelRecord.java
@@ -29,87 +29,284 @@ import java.util.List;
public class ModelRecord {
- public static final String LIMIT_ONE = "one";
- public static final String LIMIT_MANY = "many";
+ private static final String LIMIT_ONE = "one";
+ private static final String LIMIT_MANY = "many";
/** The name of the Record */
- public String name = "";
+ private String name = "";
/** The type-code of the Record */
- public String typeCode = "";
+ private String typeCode = "";
/** The minimum type-code of the Record, an alternative to the single type code */
- public String tcMin = "";
- public long tcMinNum = -1;
+ private String tcMin = "";
+ private long tcMinNum = -1;
/** The maximum type-code of the Record, an alternative to the single type code */
- public String tcMax = "";
- public long tcMaxNum = -1;
+ private String tcMax = "";
+ private long tcMaxNum = -1;
/** specifies whether or not the type min and max are numbers, if so does a number compare, otherwise a String compare */
- public boolean tcIsNum = true;
+ private boolean tcIsNum = true;
/** The position of the type-code of the Record */
- public int tcPosition = -1;
+ private int tcPosition = -1;
/** The length of the type-code of the Record - optional */
- public int tcLength = -1;
+ private int tcLength = -1;
/** A free form description of the Record */
- public String description = "";
+ private String description = "";
/** The name of the parent record for this record, if any */
- public String parentName = "";
+ private String parentName = "";
/** The number limit of records to go under the parent, may be one or many */
- public String limit = "";
+ private String limit = "";
- public ModelRecord parentRecord = null;
- public List<ModelRecord> childRecords = new ArrayList<>();
+ private ModelRecord parentRecord = null;
+ private List<ModelRecord> childRecords = new ArrayList<>();
/** List of the fields that compose this record */
- public List<ModelField> fields = new ArrayList<>();
+ private List<ModelField> fields = new ArrayList<>();
+ /**
+ * Gets model field.
+ * @param fieldName the field name
+ * @return the model field
+ */
ModelField getModelField(String fieldName) {
for (ModelField curField: fields) {
- if (curField.name.equals(fieldName)) {
+ if (curField.getName().equals(fieldName)) {
return curField;
}
}
return null;
}
+ /**
+ * Gets name.
+ * @return the name
+ */
public String getName() {
return name;
}
+ /**
+ * Sets name.
+ * @param name the name
+ */
public void setName(String name) {
this.name = name;
}
+ /**
+ * Gets description.
+ * @return the description
+ */
public String getDescription() {
return description;
}
+ /**
+ * Sets description.
+ * @param description the description
+ */
public void setDescription(String description) {
this.description = description;
}
+ /**
+ * Gets parent name.
+ * @return the parent name
+ */
public String getParentName() {
return parentName;
}
+ /**
+ * Sets parent name.
+ * @param parentName the parent name
+ */
public void setParentName(String parentName) {
this.parentName = parentName;
}
+ /**
+ * Gets fields.
+ * @return the fields
+ */
public List<ModelField> getFields() {
return fields;
}
+ /**
+ * Sets fields.
+ * @param fields the fields
+ */
public void setFields(List<ModelField> fields) {
this.fields = fields;
}
+
+ /**
+ * Gets type code.
+ * @return the type code
+ */
+ public String getTypeCode() {
+ return typeCode;
+ }
+
+ /**
+ * Gets tc position.
+ * @return the tc position
+ */
+ public int getTcPosition() {
+ return tcPosition;
+ }
+
+ /**
+ * Sets type code.
+ * @param typeCode the type code
+ */
+ public void setTypeCode(String typeCode) {
+ this.typeCode = typeCode;
+ }
+
+ /**
+ * Sets tc min.
+ * @param tcMin the tc min
+ */
+ public void setTcMin(String tcMin) {
+ this.tcMin = tcMin;
+ }
+
+ /**
+ * Sets tc max.
+ * @param tcMax the tc max
+ */
+ public void setTcMax(String tcMax) {
+ this.tcMax = tcMax;
+ }
+
+ /**
+ * Sets tc is num.
+ * @param tcIsNum the tc is num
+ */
+ public void setTcIsNum(boolean tcIsNum) {
+ this.tcIsNum = tcIsNum;
+ }
+
+ /**
+ * Gets tc min.
+ * @return the tc min
+ */
+ public String getTcMin() {
+ return tcMin;
+ }
+
+ /**
+ * Gets tc max.
+ * @return the tc max
+ */
+ public String getTcMax() {
+ return tcMax;
+ }
+
+ /**
+ * Gets tc length.
+ * @return the tc length
+ */
+ public int getTcLength() {
+ return tcLength;
+ }
+
+ /**
+ * Sets tc position.
+ * @param tcPosition the tc position
+ */
+ public void setTcPosition(int tcPosition) {
+ this.tcPosition = tcPosition;
+ }
+
+ /**
+ * Sets tc min num.
+ * @param tcMinNum the tc min num
+ */
+ public void setTcMinNum(long tcMinNum) {
+ this.tcMinNum = tcMinNum;
+ }
+
+ /**
+ * Sets tc max num.
+ * @param tcMaxNum the tc max num
+ */
+ public void setTcMaxNum(long tcMaxNum) {
+ this.tcMaxNum = tcMaxNum;
+ }
+
+ /**
+ * Gets tc min num.
+ * @return the tc min num
+ */
+ public long getTcMinNum() {
+ return tcMinNum;
+ }
+
+ /**
+ * Gets tc max num.
+ * @return the tc max num
+ */
+ public long getTcMaxNum() {
+ return tcMaxNum;
+ }
+
+ /**
+ * Is tc is num boolean.
+ * @return the boolean
+ */
+ public boolean isTcIsNum() {
+ return tcIsNum;
+ }
+
+ /**
+ * Sets tc length.
+ * @param tcLength the tc length
+ */
+ public void setTcLength(int tcLength) {
+ this.tcLength = tcLength;
+ }
+
+ /**
+ * Sets limit.
+ * @param limit the limit
+ */
+ public void setLimit(String limit) {
+ this.limit = limit;
+ }
+
+ /**
+ * Gets parent record.
+ * @return the parent record
+ */
+ public ModelRecord getParentRecord() {
+ return parentRecord;
+ }
+
+ /**
+ * Gets child records.
+ * @return the child records
+ */
+ public List<ModelRecord> getChildRecords() {
+ return childRecords;
+ }
+
+ /**
+ * Sets parent record.
+ * @param parentRecord the parent record
+ */
+ public void setParentRecord(ModelRecord parentRecord) {
+ this.parentRecord = parentRecord;
+ }
}
diff --git a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java
index ef92968..b5b5e70 100644
--- a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java
+++ b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java
@@ -42,23 +42,23 @@ import org.apache.ofbiz.common.login.LoginServices;
public class Record implements Serializable {
/** Contains a map with field data by name */
- protected Map<String, Object> fields;
+ private Map<String, Object> fields;
/** Contains the name of the record definition */
- protected String recordName;
+ private String recordName;
/** Contains the definition for the record */
- protected transient ModelRecord modelRecord;
+ private transient ModelRecord modelRecord;
- protected Record parentRecord = null;
- protected List<Record> childRecords = new ArrayList<>();
+ private Record parentRecord = null;
+ private List<Record> childRecords = new ArrayList<>();
/** Creates new Record */
protected Record(ModelRecord modelRecord) {
if (modelRecord == null) {
throw new IllegalArgumentException("Cannont create a Record with a null modelRecord parameter");
}
- this.recordName = modelRecord.name;
+ this.recordName = modelRecord.getName();
this.modelRecord = modelRecord;
this.fields = new HashMap<>();
}
@@ -68,15 +68,23 @@ public class Record implements Serializable {
if (modelRecord == null) {
throw new IllegalArgumentException("Cannont create a Record with a null modelRecord parameter");
}
- this.recordName = modelRecord.name;
+ this.recordName = modelRecord.getName();
this.modelRecord = modelRecord;
this.fields = (fields == null ? new HashMap<>() : new HashMap<>(fields));
}
+ /**
+ * Gets record name.
+ * @return the record name
+ */
public String getRecordName() {
return recordName;
}
+ /**
+ * Gets model record.
+ * @return the model record
+ */
public ModelRecord getModelRecord() {
if (modelRecord == null) {
throw new IllegalStateException("[Record.getModelRecord] could not find modelRecord for recordName " + recordName);
@@ -84,6 +92,11 @@ public class Record implements Serializable {
return modelRecord;
}
+ /**
+ * Get object.
+ * @param name the name
+ * @return the object
+ */
public synchronized Object get(String name) {
if (getModelRecord().getModelField(name) == null) {
throw new IllegalArgumentException("[Record.get] \"" + name + "\" is not a field of " + recordName);
@@ -91,6 +104,11 @@ public class Record implements Serializable {
return fields.get(name);
}
+ /**
+ * Gets string.
+ * @param name the name
+ * @return the string
+ */
public String getString(String name) {
Object object = get(name);
@@ -103,6 +121,11 @@ public class Record implements Serializable {
return object.toString();
}
+ /**
+ * Gets string and empty.
+ * @param name the name
+ * @return the string and empty
+ */
public String getStringAndEmpty(String name) {
Object object = get(name);
@@ -115,30 +138,65 @@ public class Record implements Serializable {
return object.toString();
}
+ /**
+ * Gets timestamp.
+ * @param name the name
+ * @return the timestamp
+ */
public java.sql.Timestamp getTimestamp(String name) {
return (java.sql.Timestamp) get(name);
}
+ /**
+ * Gets time.
+ * @param name the name
+ * @return the time
+ */
public java.sql.Time getTime(String name) {
return (java.sql.Time) get(name);
}
+ /**
+ * Gets date.
+ * @param name the name
+ * @return the date
+ */
public java.sql.Date getDate(String name) {
return (java.sql.Date) get(name);
}
+ /**
+ * Gets integer.
+ * @param name the name
+ * @return the integer
+ */
public Integer getInteger(String name) {
return (Integer) get(name);
}
+ /**
+ * Gets long.
+ * @param name the name
+ * @return the long
+ */
public Long getLong(String name) {
return (Long) get(name);
}
+ /**
+ * Gets float.
+ * @param name the name
+ * @return the float
+ */
public Float getFloat(String name) {
return (Float) get(name);
}
+ /**
+ * Gets double.
+ * @param name the name
+ * @return the double
+ */
public Double getDouble(String name) {
return (Double) get(name);
}
@@ -189,8 +247,8 @@ public class Record implements Serializable {
*/
private static long readLELong(byte[] byteArray) {
return (long) (byteArray[7]) << 56 | /* long cast needed or shift done modulo 32 */
- (long) (byteArray[6] & 0xff) << 48 | (long) (byteArray[5] & 0xff) << 40 | (long) (byteArray[4] & 0xff) << 32 | (long) (byteArray[3] & 0xff) << 24
- | (long) (byteArray[2] & 0xff) << 16 | (long) (byteArray[1] & 0xff) << 8 | (byteArray[0] & 0xff);
+ (long) (byteArray[6] & 0xff) << 48 | (long) (byteArray[5] & 0xff) << 40 | (long) (byteArray[4] & 0xff) << 32 | (long) (byteArray[3]
+ & 0xff) << 24 | (long) (byteArray[2] & 0xff) << 16 | (long) (byteArray[1] & 0xff) << 8 | (byteArray[0] & 0xff);
}
/** Sets the named field to the passed value, converting the value from a String to the current type using <code>Type.valueOf()</code>
@@ -220,28 +278,28 @@ public class Record implements Serializable {
return;
}
- String fieldType = field.type;
+ String fieldType = field.getType();
// first the custom types that need to be parsed
if (fieldType.equals("CustomTimestamp")) {
// this custom type will take a string a parse according to date formatting
// string then put the result in a java.sql.Timestamp
// a common timestamp format for flat files is with no separators: yyyyMMddHHmmss
- SimpleDateFormat sdf = new SimpleDateFormat(field.format);
+ SimpleDateFormat sdf = new SimpleDateFormat(field.getFormat());
java.util.Date tempDate = sdf.parse(value);
java.sql.Timestamp timestamp = new java.sql.Timestamp(tempDate.getTime());
set(name, timestamp);
} else if (fieldType.equals("CustomDate")) {
// a common date only format for flat files is with no separators: yyyyMMdd or MMddyyyy
- SimpleDateFormat sdf = new SimpleDateFormat(field.format);
+ SimpleDateFormat sdf = new SimpleDateFormat(field.getFormat());
java.util.Date tempDate = sdf.parse(value);
java.sql.Date date = new java.sql.Date(tempDate.getTime());
set(name, date);
} else if (fieldType.equals("CustomTime")) {
// a common time only format for flat files is with no separators: HHmmss
- SimpleDateFormat sdf = new SimpleDateFormat(field.format);
+ SimpleDateFormat sdf = new SimpleDateFormat(field.getFormat());
java.util.Date tempDate = sdf.parse(value);
java.sql.Time time = new java.sql.Time(tempDate.getTime());
@@ -252,14 +310,13 @@ public class Record implements Serializable {
NumberFormat nf = NumberFormat.getNumberInstance();
Number tempNum = nf.parse(value);
double number = tempNum.doubleValue();
- double decimalPlaces = Double.parseDouble(field.format);
+ double decimalPlaces = Double.parseDouble(field.getFormat());
double divisor = Math.pow(10.0, decimalPlaces);
number = number / divisor;
set(name, number);
- } // standard types
- else if (fieldType.equals("java.lang.String") || fieldType.equals("String")) {
- if (field.format.equals("EncryptedString")) {
+ } else if (fieldType.equals("java.lang.String") || fieldType.equals("String")) {
+ if (field.getFormat().equals("EncryptedString")) {
String hashType = LoginServices.getHashType();
set(name, HashCrypt.digestHash(hashType, value.getBytes(StandardCharsets.UTF_8)));
} else {
@@ -293,6 +350,11 @@ public class Record implements Serializable {
}
}
+ /**
+ * Gets fixed string.
+ * @param name the name
+ * @return the fixed string
+ */
public String getFixedString(String name) {
if (name == null) {
return null;
@@ -309,39 +371,38 @@ public class Record implements Serializable {
return null;
}
- String fieldType = field.type;
+ String fieldType = field.getType();
String str = null;
// first the custom types that need to be parsed
if (fieldType.equals("CustomTimestamp")) {
// a common timestamp format for flat files is with no separators: yyyyMMddHHmmss
- SimpleDateFormat sdf = new SimpleDateFormat(field.format);
+ SimpleDateFormat sdf = new SimpleDateFormat(field.getFormat());
java.sql.Timestamp timestamp = (java.sql.Timestamp) value;
str = sdf.format(new Date(timestamp.getTime()));
} else if (fieldType.equals("CustomDate")) {
// a common date only format for flat files is with no separators: yyyyMMdd or MMddyyyy
- SimpleDateFormat sdf = new SimpleDateFormat(field.format);
+ SimpleDateFormat sdf = new SimpleDateFormat(field.getFormat());
java.sql.Date date = (java.sql.Date) value;
str = sdf.format(new Date(date.getTime()));
} else if (fieldType.equals("CustomTime")) {
// a common time only format for flat files is with no separators: HHmmss
- SimpleDateFormat sdf = new SimpleDateFormat(field.format);
+ SimpleDateFormat sdf = new SimpleDateFormat(field.getFormat());
java.sql.Time time = (java.sql.Time) value;
str = sdf.format(new Date(time.getTime()));
} else if (fieldType.equals("FixedPointDouble")) {
// this custom type will parse a fixed point number according to the number
// of decimal places in the formatting string then place it in a Double
- double decimalPlaces = Double.parseDouble(field.format);
+ double decimalPlaces = Double.parseDouble(field.getFormat());
double multiplier = Math.pow(10.0, decimalPlaces);
double dnum = multiplier * (Double) value;
long number = Math.round(dnum);
- str = padFrontZeros(Long.toString(number), field.length);
- } // standard types
- else if (fieldType.equals("java.lang.String") || fieldType.equals("String")) {
+ str = padFrontZeros(Long.toString(number), field.getLength());
+ } else if (fieldType.equals("java.lang.String") || fieldType.equals("String")) {
str = value.toString();
} else if (fieldType.equals("java.sql.Timestamp") || fieldType.equals("Timestamp")) {
str = value.toString();
@@ -350,22 +411,22 @@ public class Record implements Serializable {
} else if (fieldType.equals("java.sql.Date") || fieldType.equals("Date")) {
str = value.toString();
} else if (fieldType.equals("java.lang.Integer") || fieldType.equals("Integer")) {
- str = padFrontZeros(value.toString(), field.length);
+ str = padFrontZeros(value.toString(), field.getLength());
} else if (fieldType.equals("java.lang.Long") || fieldType.equals("Long")) {
- str = padFrontZeros(value.toString(), field.length);
+ str = padFrontZeros(value.toString(), field.getLength());
} else if (fieldType.equals("java.lang.Float") || fieldType.equals("Float")) {
- str = padFrontZeros(value.toString(), field.length);
+ str = padFrontZeros(value.toString(), field.getLength());
} else if (fieldType.equals("java.lang.Double") || fieldType.equals("Double")) {
- str = padFrontZeros(value.toString(), field.length);
+ str = padFrontZeros(value.toString(), field.getLength());
} else {
throw new IllegalArgumentException("Field type " + fieldType + " not currently supported. Sorry.");
}
- if (str != null && field.length > 0 && str.length() < field.length) {
+ if (str != null && field.getLength() > 0 && str.length() < field.getLength()) {
// pad the end with spaces
StringBuilder strBuf = new StringBuilder(str);
- while (strBuf.length() < field.length) {
+ while (strBuf.length() < field.getLength()) {
strBuf.append(' ');
}
str = strBuf.toString();
@@ -373,50 +434,56 @@ public class Record implements Serializable {
return str;
}
+ /**
+ * Write line string string.
+ * @param modelDataFile the model data file
+ * @return the string
+ * @throws DataFileException the data file exception
+ */
public String writeLineString(ModelDataFile modelDataFile) throws DataFileException {
ModelRecord modelRecord = getModelRecord();
- boolean isFixedRecord = ModelDataFile.SEP_FIXED_RECORD.equals(modelDataFile.separatorStyle);
- boolean isFixedLength = ModelDataFile.SEP_FIXED_LENGTH.equals(modelDataFile.separatorStyle);
- boolean isDelimited = ModelDataFile.SEP_DELIMITED.equals(modelDataFile.separatorStyle);
+ boolean isFixedRecord = ModelDataFile.SEP_FIXED_RECORD.equals(modelDataFile.getSeparatorStyle());
+ boolean isFixedLength = ModelDataFile.SEP_FIXED_LENGTH.equals(modelDataFile.getSeparatorStyle());
+ boolean isDelimited = ModelDataFile.SEP_DELIMITED.equals(modelDataFile.getSeparatorStyle());
StringBuilder lineBuf = new StringBuilder();
- for (ModelField modelField : modelRecord.fields) {
- String data = this.getFixedString(modelField.name);
+ for (ModelField modelField : modelRecord.getFields()) {
+ String data = this.getFixedString(modelField.getName());
- if (isDelimited && null != modelDataFile.textDelimiter) {
- lineBuf.append(modelDataFile.textDelimiter);
+ if (isDelimited && null != modelDataFile.getTextDelimiter()) {
+ lineBuf.append(modelDataFile.getTextDelimiter());
}
// if field is null (not set) then assume we want to pad the field
- char PAD_CHAR = ' ';
+ char padChar = ' ';
if (data == null) {
StringBuilder sb = new StringBuilder("");
- for (int i = 0; i < modelField.length; i++) {
- sb.append(PAD_CHAR);
+ for (int i = 0; i < modelField.getLength(); i++) {
+ sb.append(padChar);
}
data = sb.toString();
}
// Pad the record
if (isFixedRecord) {
- while (modelField.position > lineBuf.length()) {
+ while (modelField.getPosition() > lineBuf.length()) {
lineBuf.append(" ");
}
}
- if (modelField.length > 0 && data.length() != modelField.length) {
- throw new DataFileException("Got field length " + data.length() + " but expected field length is " + modelField.length + " for field \"" + modelField.name
- + "\" of record \"" + modelRecord.name + "\" data is: \"" + data + "\"");
+ if (modelField.getLength() > 0 && data.length() != modelField.getLength()) {
+ throw new DataFileException("Got field length " + data.length() + " but expected field length is " + modelField.getLength()
+ + " for field \"" + modelField.getName() + "\" of record \"" + modelRecord.getName() + "\" data is: \"" + data + "\"");
}
lineBuf.append(data);
if (isDelimited) {
- if (null != modelDataFile.textDelimiter) {
- lineBuf.append(modelDataFile.textDelimiter);
+ if (null != modelDataFile.getTextDelimiter()) {
+ lineBuf.append(modelDataFile.getTextDelimiter());
}
- lineBuf.append(modelDataFile.delimiter);
+ lineBuf.append(modelDataFile.getDelimiter());
}
}
@@ -425,14 +492,14 @@ public class Record implements Serializable {
lineBuf.setLength(lineBuf.length() - 1);
}
- if ((isFixedRecord || isFixedLength) && modelDataFile.recordLength > 0 && lineBuf.length() != modelDataFile.recordLength) {
- throw new DataFileException("Got record length " + lineBuf.length() + " but expected record length is " + modelDataFile.recordLength + " for record \""
- + modelRecord.name + "\" data line is: \"" + lineBuf + "\"");
+ if ((isFixedRecord || isFixedLength) && modelDataFile.getRecordLength() > 0 && lineBuf.length() != modelDataFile.getRecordLength()) {
+ throw new DataFileException("Got record length " + lineBuf.length() + " but expected record length is " + modelDataFile.getRecordLength()
+ + " for record \"" + modelRecord.getName() + "\" data line is: \"" + lineBuf + "\"");
}
// for convenience, insert the type-code in where it is looked for, if exists
- if (modelRecord.tcPosition > 0 && modelRecord.typeCode.length() > 0) {
- lineBuf.replace(modelRecord.tcPosition, modelRecord.tcPosition + modelRecord.tcLength, modelRecord.typeCode);
+ if (modelRecord.getTcPosition() > 0 && modelRecord.getTypeCode().length() > 0) {
+ lineBuf.replace(modelRecord.getTcPosition(), modelRecord.getTcPosition() + modelRecord.getTcLength(), modelRecord.getTypeCode());
}
if (isFixedLength || isDelimited) {
@@ -446,6 +513,12 @@ public class Record implements Serializable {
return lineBuf.toString();
}
+ /**
+ * Pad front zeros string.
+ * @param str the str
+ * @param totalLength the total length
+ * @return the string
+ */
String padFrontZeros(String str, int totalLength) {
if (totalLength > 0 && str.length() < totalLength) {
// pad the front with zeros
@@ -461,14 +534,26 @@ public class Record implements Serializable {
return str;
}
+ /**
+ * Gets parent record.
+ * @return the parent record
+ */
public Record getParentRecord() {
return parentRecord;
}
+ /**
+ * Gets child records.
+ * @return the child records
+ */
public List<Record> getChildRecords() {
return childRecords;
}
+ /**
+ * Add child record.
+ * @param record the record
+ */
public void addChildRecord(Record record) {
childRecords.add(record);
}
@@ -506,24 +591,25 @@ public class Record implements Serializable {
public static Record createRecord(String line, int lineNum, ModelRecord modelRecord) throws DataFileException {
Record record = new Record(modelRecord);
- for (ModelField modelField : modelRecord.fields) {
+ for (ModelField modelField : modelRecord.getFields()) {
String strVal = null;
try {
- strVal = line.substring(modelField.position, modelField.position + modelField.length);
+ strVal = line.substring(modelField.getPosition(), modelField.getPosition() + modelField.getLength());
} catch (IndexOutOfBoundsException ioobe) {
- throw new DataFileException("Field " + modelField.name + " from " + modelField.position + " for " + modelField.length + " chars could not be read from a line ("
- + lineNum + ") with only " + line.length() + " chars.",
- ioobe);
+ throw new DataFileException("Field " + modelField.getName() + " from " + modelField.getPosition() + " for " + modelField.getLength()
+ + " chars could not be read from a line (" + lineNum + ") with only " + line.length() + " chars.", ioobe);
}
try {
- record.setString(modelField.name, strVal);
+ record.setString(modelField.getName(), strVal);
} catch (java.text.ParseException e) {
throw new DataFileException(
- "Could not parse field " + modelField.name + ", format string \"" + modelField.format + "\" with value " + strVal + " on line " + lineNum, e);
+ "Could not parse field " + modelField.getName() + ", format string \"" + modelField.getFormat() + "\" with value " + strVal
+ + " on line " + lineNum, e);
} catch (java.lang.NumberFormatException e) {
throw new DataFileException(
- "Number not valid for field " + modelField.name + ", format string \"" + modelField.format + "\" with value " + strVal + " on line " + lineNum, e);
+ "Number not valid for field " + modelField.getName() + ", format string \"" + modelField.getFormat() + "\" with value "
+ + strVal + " on line " + lineNum, e);
}
}
return record;
@@ -537,7 +623,8 @@ public class Record implements Serializable {
* @throws DataFileException Exception thown for various errors, generally has a nested exception
* @return return a Record Object
*/
- public static Record createDelimitedRecord(String line, int lineNum, ModelRecord modelRecord, char delimiter, String textDelimiter) throws DataFileException {
+ public static Record createDelimitedRecord(String line, int lineNum, ModelRecord modelRecord, char delimiter, String textDelimiter)
+ throws DataFileException {
Record record = new Record(modelRecord);
StringTokenizer st = null;
@@ -546,15 +633,15 @@ public class Record implements Serializable {
} else {
st = new StringTokenizer(line, "" + delimiter, true);
}
- for (ModelField modelField : modelRecord.fields) {
+ for (ModelField modelField : modelRecord.getFields()) {
String strVal = null;
- if (modelField.expression) {
- if (UtilValidate.isNotEmpty(modelField.refField)) {
- strVal = record.getString(modelField.refField);
+ if (modelField.isExpression()) {
+ if (UtilValidate.isNotEmpty(modelField.getRefField())) {
+ strVal = record.getString(modelField.getRefField());
}
if (strVal == null) {
- strVal = (String) modelField.defaultValue;
+ strVal = (String) modelField.getDefaultValue();
}
} else {
//some input lines may be less than the header model.
@@ -567,12 +654,14 @@ public class Record implements Serializable {
st.nextToken();
}
} catch (NoSuchElementException nsee) {
- throw new DataFileException("Field " + modelField.name + " could not be read from a line (" + lineNum + ") with only " + line.length() + " chars.", nsee);
+ throw new DataFileException("Field " + modelField.getName() + " could not be read from a line (" + lineNum
+ + ") with only " + line.length() + " chars.", nsee);
}
}
}
try {
- if (textDelimiter != null && strVal != null && (strVal.startsWith(textDelimiter) && (!strVal.endsWith(textDelimiter) || strVal.length() == 1))) {
+ if (textDelimiter != null && strVal != null && (strVal.startsWith(textDelimiter) && (!strVal.endsWith(textDelimiter)
+ || strVal.length() == 1))) {
strVal = strVal.concat("" + delimiter);
while (!strVal.endsWith(textDelimiter)) {
strVal = strVal.concat(st.nextToken());
@@ -582,13 +671,15 @@ public class Record implements Serializable {
if (textDelimiter != null && strVal != null && (strVal.startsWith(textDelimiter) && strVal.endsWith(textDelimiter))) {
strVal = strVal.substring(textDelimiter.length(), strVal.length() - textDelimiter.length());
}
- record.setString(modelField.name, strVal);
+ record.setString(modelField.getName(), strVal);
} catch (java.text.ParseException e) {
throw new DataFileException(
- "Could not parse field " + modelField.name + ", format string \"" + modelField.format + "\" with value " + strVal + " on line " + lineNum, e);
+ "Could not parse field " + modelField.getName() + ", format string \"" + modelField.getFormat() + "\" with value " + strVal
+ + " on line " + lineNum, e);
} catch (java.lang.NumberFormatException e) {
throw new DataFileException(
- "Number not valid for field " + modelField.name + ", format string \"" + modelField.format + "\" with value " + strVal + " on line " + lineNum, e);
+ "Number not valid for field " + modelField.getName() + ", format string \"" + modelField.getFormat() + "\" with value "
+ + strVal + " on line " + lineNum, e);
}
}
return record;
diff --git a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/RecordIterator.java b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/RecordIterator.java
index 6ee686d..67f5174 100644
--- a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/RecordIterator.java
+++ b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/RecordIterator.java
@@ -27,26 +27,26 @@ import java.nio.charset.Charset;
import java.util.Stack;
/**
- * Record Iterator for reading large files
- * Note: this is a memory intensive and will not handle files that exceed memory.
- *
+ * Record Iterator for reading large files
+ * Note: this is a memory intensive and will not handle files that exceed memory.
*/
public class RecordIterator {
private static final String MODULE = RecordIterator.class.getName();
- protected BufferedReader br;
- protected ModelDataFile modelDataFile;
- protected InputStream dataFileStream;
- protected boolean closed = false;
- protected String locationInfo;
+ private BufferedReader br;
+ private ModelDataFile modelDataFile;
+ private InputStream dataFileStream;
+ private boolean closed = false;
+ private String locationInfo;
- protected int nextLineNum = 0;
- protected String curLine = null;
- protected Record curRecord = null;
- protected String nextLine = null;
- protected Record nextRecord = null;
- protected String eof = "\u001A"; // aka ASCII char 26, aka substitute, aka 0x1A, aka CTRL-Z, aka EOF DOS character. Added because problems in some DOS file, specifically file extracted from zip archives.
+ private int nextLineNum = 0;
+ private String curLine = null;
+ private Record curRecord = null;
+ private String nextLine = null;
+ private Record nextRecord = null;
+ private String eof = "\u001A"; // aka ASCII char 26, aka substitute, aka 0x1A, aka CTRL-Z, aka EOF DOS character. Added because problems in
+ // some DOS file, specifically file extracted from zip archives.
public RecordIterator(URL fileUrl, ModelDataFile modelDataFile) throws DataFileException {
this.modelDataFile = modelDataFile;
@@ -65,6 +65,12 @@ public class RecordIterator {
this.setupStream(dataFileStream, locationInfo);
}
+ /**
+ * Sets stream.
+ * @param dataFileStream the data file stream
+ * @param locationInfo the location info
+ * @throws DataFileException the data file exception
+ */
protected void setupStream(InputStream dataFileStream, String locationInfo) throws DataFileException {
this.locationInfo = locationInfo;
this.dataFileStream = dataFileStream;
@@ -76,7 +82,7 @@ public class RecordIterator {
}
//move the cursor to the good start line
try {
- for (int i = 0; i < modelDataFile.startLine; i++) {
+ for (int i = 0; i < modelDataFile.getStartLine(); i++) {
br.readLine();
}
} catch (IOException e) {
@@ -86,29 +92,33 @@ public class RecordIterator {
this.getNextLine();
}
+ /**
+ * Gets next line.
+ * @return the next line
+ * @throws DataFileException the data file exception
+ */
protected boolean getNextLine() throws DataFileException {
this.nextLine = null;
this.nextRecord = null;
- boolean isFixedRecord = ModelDataFile.SEP_FIXED_RECORD.equals(modelDataFile.separatorStyle);
- boolean isDelimited = ModelDataFile.SEP_DELIMITED.equals(modelDataFile.separatorStyle);
+ boolean isFixedRecord = ModelDataFile.SEP_FIXED_RECORD.equals(modelDataFile.getSeparatorStyle());
+ boolean isDelimited = ModelDataFile.SEP_DELIMITED.equals(modelDataFile.getSeparatorStyle());
if (isFixedRecord) {
- if (modelDataFile.recordLength <= 0) {
+ if (modelDataFile.getRecordLength() <= 0) {
throw new DataFileException("Cannot read a fixed record length file if no record length is specified");
}
try {
- char[] charData = new char[modelDataFile.recordLength + 1];
+ char[] charData = new char[modelDataFile.getRecordLength() + 1];
- if (br.read(charData, 0, modelDataFile.recordLength) == -1) {
+ if (br.read(charData, 0, modelDataFile.getRecordLength()) == -1) {
nextLine = null;
} else {
nextLine = new String(charData);
}
} catch (IOException e) {
- throw new DataFileException("Error reading line #" + nextLineNum + " (index " + (nextLineNum - 1) * modelDataFile.recordLength + " length "
- + modelDataFile.recordLength + ") from location: " + locationInfo,
- e);
+ throw new DataFileException("Error reading line #" + nextLineNum + " (index " + (nextLineNum - 1) * modelDataFile.getRecordLength()
+ + " length " + modelDataFile.getRecordLength() + ") from location: " + locationInfo, e);
}
} else {
try {
@@ -122,7 +132,8 @@ public class RecordIterator {
nextLineNum++;
ModelRecord modelRecord = findModelForLine(nextLine, nextLineNum, modelDataFile);
if (isDelimited) {
- this.nextRecord = Record.createDelimitedRecord(nextLine, nextLineNum, modelRecord, modelDataFile.delimiter, modelDataFile.textDelimiter);
+ this.nextRecord = Record.createDelimitedRecord(nextLine, nextLineNum, modelRecord, modelDataFile.getDelimiter(),
+ modelDataFile.getTextDelimiter());
} else {
this.nextRecord = Record.createRecord(nextLine, nextLineNum, modelRecord);
}
@@ -133,22 +144,37 @@ public class RecordIterator {
}
}
+ /**
+ * Gets current line number.
+ * @return the current line number
+ */
public int getCurrentLineNumber() {
return this.nextLineNum - 1;
}
+ /**
+ * Has next boolean.
+ * @return the boolean
+ */
public boolean hasNext() {
return nextLine != null && !((nextLine.contains(eof)));
}
+ /**
+ * Next record.
+ * @return the record
+ * @throws DataFileException the data file exception
+ */
public Record next() throws DataFileException {
+ int recordLength = modelDataFile.getRecordLength();
if (!hasNext()) {
return null;
}
- if (ModelDataFile.SEP_DELIMITED.equals(modelDataFile.separatorStyle) || ModelDataFile.SEP_FIXED_RECORD.equals(modelDataFile.separatorStyle)
- || ModelDataFile.SEP_FIXED_LENGTH.equals(modelDataFile.separatorStyle)) {
- boolean isFixedRecord = ModelDataFile.SEP_FIXED_RECORD.equals(modelDataFile.separatorStyle);
+ if (ModelDataFile.SEP_DELIMITED.equals(modelDataFile.getSeparatorStyle())
+ || ModelDataFile.SEP_FIXED_RECORD.equals(modelDataFile.getSeparatorStyle())
+ || ModelDataFile.SEP_FIXED_LENGTH.equals(modelDataFile.getSeparatorStyle())) {
+ boolean isFixedRecord = ModelDataFile.SEP_FIXED_RECORD.equals(modelDataFile.getSeparatorStyle());
// advance the line (we have already checked to make sure there is a next line
this.curLine = this.nextLine;
this.curRecord = this.nextRecord;
@@ -157,23 +183,24 @@ public class RecordIterator {
this.getNextLine();
// first check to see if the file type has a line size, and if so if this line complies
- if (!isFixedRecord && modelDataFile.recordLength > 0 && curLine.length() != modelDataFile.recordLength) {
+ if (!isFixedRecord && recordLength > 0 && curLine.length() != recordLength) {
throw new DataFileException(
- "Line number " + this.getCurrentLineNumber() + " was not the expected length; expected: " + modelDataFile.recordLength + ", got: " + curLine.length());
+ "Line number " + this.getCurrentLineNumber() + " was not the expected length; expected: " + recordLength
+ + ", got: " + curLine.length());
}
// if this record has children, put it on the parentStack and get/check the children now
- if (this.curRecord.getModelRecord().childRecords.size() > 0) {
+ if (this.curRecord.getModelRecord().getChildRecords().size() > 0) {
Stack<Record> parentStack = new Stack<>();
parentStack.push(curRecord);
- while (this.nextRecord != null && this.nextRecord.getModelRecord().parentRecord != null) {
+ while (this.nextRecord != null && this.nextRecord.getModelRecord().getParentRecord() != null) {
// if parent equals top parent on stack, add to that parents child list, otherwise pop off parent and try again
Record parentRecord = null;
while (parentStack.size() > 0) {
parentRecord = parentStack.peek();
- if (parentRecord.recordName.equals(this.nextRecord.getModelRecord().parentName)) {
+ if (parentRecord.getRecordName().equals(this.nextRecord.getModelRecord().getParentName())) {
break;
} else {
parentStack.pop();
@@ -181,13 +208,13 @@ public class RecordIterator {
}
}
if (parentRecord == null) {
- throw new DataFileException("Expected Parent Record not found for line " + this.getCurrentLineNumber() + "; record name of expected parent is "
- + this.nextRecord.getModelRecord().parentName);
+ throw new DataFileException("Expected Parent Record not found for line " + this.getCurrentLineNumber()
+ + "; record name of expected parent is " + this.nextRecord.getModelRecord().getParentName());
}
parentRecord.addChildRecord(this.nextRecord);
// if the child record we just added is also a parent, push it onto the stack
- if (this.nextRecord.getModelRecord().childRecords.size() > 0) {
+ if (this.nextRecord.getModelRecord().getChildRecords().size() > 0) {
parentStack.push(this.nextRecord);
}
// if it can't find a next line it will nextRecord will be null and the loop will break out
@@ -195,11 +222,15 @@ public class RecordIterator {
}
}
} else {
- throw new DataFileException("Separator style " + modelDataFile.separatorStyle + " not recognized.");
+ throw new DataFileException("Separator style " + modelDataFile.getSeparatorStyle() + " not recognized.");
}
return curRecord;
}
+ /**
+ * Close.
+ * @throws DataFileException the data file exception
+ */
public void close() throws DataFileException {
if (this.closed) {
return;
@@ -212,7 +243,8 @@ public class RecordIterator {
}
}
- /** Searches through the record models to find one with a matching type-code, if no type-code exists that model will always be used if it gets to it
+ /** Searches through the record models to find one with a matching type-code, if no type-code exists that model will always be used if
+ * it gets to it
* @param line
* @param lineNum
* @param modelDataFile
@@ -222,29 +254,29 @@ public class RecordIterator {
protected static ModelRecord findModelForLine(String line, int lineNum, ModelDataFile modelDataFile) throws DataFileException {
ModelRecord modelRecord = null;
- for (ModelRecord curModelRecord : modelDataFile.records) {
- if (curModelRecord.tcPosition < 0) {
+ for (ModelRecord curModelRecord : modelDataFile.getRecords()) {
+ if (curModelRecord.getTcPosition() < 0) {
modelRecord = curModelRecord;
break;
}
- String typeCode = line.substring(curModelRecord.tcPosition, curModelRecord.tcPosition + curModelRecord.tcLength);
+ String typeCode = line.substring(curModelRecord.getTcPosition(), curModelRecord.getTcPosition() + curModelRecord.getTcLength());
// try to match with a single typecode
- if (curModelRecord.typeCode.length() > 0) {
- if (!typeCode.isEmpty() && typeCode.equals(curModelRecord.typeCode)) {
+ if (curModelRecord.getTypeCode().length() > 0) {
+ if (!typeCode.isEmpty() && typeCode.equals(curModelRecord.getTypeCode())) {
modelRecord = curModelRecord;
break;
}
- } // try to match a ranged typecode (tcMin <= typeCode <= tcMax)
- else if (curModelRecord.tcMin.length() > 0 || curModelRecord.tcMax.length() > 0) {
- if (curModelRecord.tcIsNum) {
+ } else if (curModelRecord.getTcMin().length() > 0 || curModelRecord.getTcMax().length() > 0) {
+ if (curModelRecord.isTcIsNum()) {
long typeCodeNum = Long.parseLong(typeCode);
- if ((curModelRecord.tcMinNum < 0 || typeCodeNum >= curModelRecord.tcMinNum) && (curModelRecord.tcMaxNum < 0 || typeCodeNum <= curModelRecord.tcMaxNum)) {
+ if ((curModelRecord.getTcMinNum() < 0 || typeCodeNum >= curModelRecord.getTcMinNum()) && (curModelRecord.getTcMaxNum() < 0
+ || typeCodeNum <= curModelRecord.getTcMaxNum())) {
modelRecord = curModelRecord;
break;
}
} else {
- if ((typeCode.compareTo(curModelRecord.tcMin) >= 0) && (typeCode.compareTo(curModelRecord.tcMax) <= 0)) {
+ if ((typeCode.compareTo(curModelRecord.getTcMin()) >= 0) && (typeCode.compareTo(curModelRecord.getTcMax()) <= 0)) {
modelRecord = curModelRecord;
break;
}
@@ -253,7 +285,8 @@ public class RecordIterator {
}
if (modelRecord == null) {
- throw new DataFileException("Could not find record definition for line " + lineNum + "; first bytes: " + line.substring(0, (line.length() > 5) ? 5 : line.length()));
+ throw new DataFileException("Could not find record definition for line " + lineNum + "; first bytes: "
+ + line.substring(0, (line.length() > 5) ? 5 : line.length()));
}
return modelRecord;
}
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/Delegator.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/Delegator.java
index 4b7bf2e..63574bc 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/Delegator.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/Delegator.java
@@ -68,7 +68,6 @@ public interface Delegator {
* Remove a CACHED Generic Entity from the cache by its primary key, does
* NOT check to see if the passed GenericPK is a complete primary key. Also
* tries to clear the corresponding all cache entry.
- *
* @param primaryKey
* The primary key to clear by.
*/
@@ -81,7 +80,6 @@ public interface Delegator {
* tries to remove entries from the all cache, the by primary key cache, and
* the by and cache. This is the ONLY method that tries to clear
* automatically from the by and cache.
- *
* @param value
* The GenericValue to clear by.
*/
@@ -91,7 +89,6 @@ public interface Delegator {
/**
* Remove all CACHED Generic Entity (List) from the cache
- *
* @param entityName
* The Name of the Entity as defined in the entity XML file
*/
@@ -100,7 +97,6 @@ public interface Delegator {
/**
* Remove a CACHED Generic Entity (List) from the cache, either a PK, ByAnd,
* or All
- *
* @param entityName
* The Name of the Entity as defined in the entity XML file
* @param fields
@@ -112,7 +108,6 @@ public interface Delegator {
/**
* Remove a CACHED Generic Entity (List) from the cache, either a PK, ByAnd,
* or All
- *
* @param entityName
* The Name of the Entity as defined in the entity XML file
* @param fields
@@ -132,7 +127,6 @@ public interface Delegator {
* complete primary key it will remove the cache line from the andCache. If
* the fields map is empty, then the allCache for the entity will be
* cleared.
- *
* @param dummyPK
* The dummy primary key to clear by.
*/
@@ -147,7 +141,6 @@ public interface Delegator {
/**
* Creates a Entity in the form of a GenericValue and write it to the
* datasource
- *
* @param primaryKey
* The GenericPK to create a value in the datasource from
* @return GenericValue instance containing the new instance
@@ -157,7 +150,6 @@ public interface Delegator {
/**
* Creates a Entity in the form of a GenericValue and write it to the
* datasource
- *
* @param value
* The GenericValue to create a value in the datasource from
* @return GenericValue instance containing the new instance
@@ -167,7 +159,6 @@ public interface Delegator {
/**
* Creates a Entity in the form of a GenericValue and write it to the
* database
- *
* @return GenericValue instance containing the new instance
*/
GenericValue create(String entityName, Map<String, ? extends Object> fields) throws GenericEntityException;
@@ -175,14 +166,12 @@ public interface Delegator {
/**
* Creates a Entity in the form of a GenericValue and write it to the
* database
- *
* @return GenericValue instance containing the new instance
*/
GenericValue create(String entityName, Object... fields) throws GenericEntityException;
/**
* Creates or stores an Entity
- *
* @param value
* The GenericValue instance containing the new or existing
* instance
@@ -195,7 +184,6 @@ public interface Delegator {
* then does a create in the database as normal. The reason to do it this
* way is that it will retry and fix the sequence if somehow the sequencer
* is in a bad state and returning a value that already exists.
- *
* @param value
* The GenericValue to create a value in the datasource from
* @return GenericValue instance containing the new instance
@@ -205,7 +193,6 @@ public interface Delegator {
/**
* Creates a Entity in the form of a GenericValue and write it to the
* database
- *
* @return GenericValue instance containing the new instance
*/
GenericValue createSingle(String entityName, Object singlePkValue) throws GenericEntityException;
@@ -217,7 +204,6 @@ public interface Delegator {
/**
* Finds GenericValues by the conditions specified in the EntityCondition
* object, the the EntityCondition javadoc for more details.
- *
* @param entityName
* The name of the Entity as defined in the entity XML file
* @param whereEntityCondition
@@ -247,7 +233,6 @@ public interface Delegator {
/**
* Finds all Generic entities
- *
* @param entityName
* The Name of the Entity as defined in the entity XML file
* @param useCache
@@ -260,7 +245,6 @@ public interface Delegator {
* Finds Generic Entity records by all of the specified fields (ie: combined
* using AND), looking first in the cache; uses orderBy for lookup, but only
* keys results on the entityName and fields
- *
* @param entityName
* The Name of the Entity as defined in the entity XML file
* @param fields
@@ -279,7 +263,6 @@ public interface Delegator {
/**
* Find a Generic Entity by its Primary Key and only returns the values
* requested by the passed keys (names).
- *
* @param primaryKey
* The primary key to find by.
* @param keys
@@ -291,7 +274,6 @@ public interface Delegator {
/**
* Gets the hit count of GenericValues for the given EntityCondition objects.
- *
* @param entityName
* @param whereEntityCondition
* @param havingEntityCondition
@@ -303,7 +285,6 @@ public interface Delegator {
/**
* Gets the hit count of GenericValues for the given EntityCondition objects.
- *
* @param entityName
* @param whereEntityCondition
* @param fieldsToSelect
@@ -318,7 +299,6 @@ public interface Delegator {
/**
* Finds GenericValues by the conditions specified in the EntityCondition
* object, the the EntityCondition javadoc for more details.
- *
* @param entityName
* The name of the Entity as defined in the entity XML file
* @param entityCondition
@@ -342,7 +322,6 @@ public interface Delegator {
/**
* Finds GenericValues by the conditions specified in the EntityCondition
* object, the the EntityCondition javadoc for more details.
- *
* @param entityName
* The name of the Entity as defined in the entity XML file
* @param entityCondition
@@ -371,7 +350,6 @@ public interface Delegator {
/**
* Finds GenericValues by the conditions specified in the EntityCondition
* object, the the EntityCondition javadoc for more details.
- *
* @param dynamicViewEntity
* The DynamicViewEntity to use for the entity model for this
* query; generally created on the fly for limited use
@@ -402,7 +380,6 @@ public interface Delegator {
/**
* Find a Generic Entity by its primary key.
- *
* @param entityName The Name of the Entity as defined in the entity XML file
* @param useCache Retrieve the Generic Entity from the cache when <code>true</code>
* @param fields The fields of the named entity to query by with their corresponding values
@@ -413,7 +390,6 @@ public interface Delegator {
/**
* Find a Generic Entity by its Primary Key
- *
* @param entityName
* The Name of the Entity as defined in the entity XML file
* @param fields
@@ -440,7 +416,6 @@ public interface Delegator {
/**
* Gets a field type instance by name from the helper that corresponds to
* the specified entity
- *
* @param entity
* The entity
* @param type
@@ -453,7 +428,6 @@ public interface Delegator {
/**
* Gets the helper name that corresponds to this delegator and the specified
* entityName
- *
* @param entityName
* The name of the entity to get the helper for
* @return String with the helper name that corresponds to this delegator
@@ -464,7 +438,6 @@ public interface Delegator {
/**
* Gets the an instance of helper that corresponds to this delegator and the
* specified entity
- *
* @param entity
* The entity to get the helper for
* @return GenericHelper that corresponds to this delegator and the
@@ -475,7 +448,6 @@ public interface Delegator {
/**
* Gets the an instance of helper that corresponds to this delegator and the
* specified entityName
- *
* @param entityName
* The name of the entity to get the helper for
* @return GenericHelper that corresponds to this delegator and the
@@ -486,7 +458,6 @@ public interface Delegator {
/**
* Gets the helper name that corresponds to this delegator and the specified
* entity
- *
* @param entity
* The entity to get the helper for
* @return String with the helper name that corresponds to this delegator
@@ -497,7 +468,6 @@ public interface Delegator {
/**
* Gets the helper name that corresponds to this delegator and the specified
* entityName
- *
* @param entityName
* The name of the entity to get the helper name for
* @return String with the helper name that corresponds to this delegator
@@ -510,7 +480,6 @@ public interface Delegator {
/**
* Gets the helper name that corresponds to this delegator and the specified
* entityName
- *
* @param groupName
* The name of the group to get the helper name for
* @return String with the helper name that corresponds to this delegator
@@ -523,7 +492,6 @@ public interface Delegator {
/**
* Gets the instance of ModelEntity that corresponds to this delegator and
* the specified entityName
- *
* @param entityName
* The name of the entity to get
* @return ModelEntity that corresponds to this delegator and the specified
@@ -534,7 +502,6 @@ public interface Delegator {
/**
* Gets a Map of entity name and entity model pairs that are in the named
* group
- *
* @param groupName The name of the group
* @return Map of entityName String keys and ModelEntity instance values
*/
@@ -544,14 +511,12 @@ public interface Delegator {
/**
* Gets the instance of ModelGroupReader that corresponds to this delegator
- *
* @return ModelGroupReader that corresponds to this delegator
*/
ModelGroupReader getModelGroupReader();
/**
* Gets the instance of ModelReader that corresponds to this delegator
- *
* @return ModelReader that corresponds to this delegator
*/
ModelReader getModelReader();
@@ -560,7 +525,6 @@ public interface Delegator {
* Get the named Related Entity for the GenericValue from the persistent
* store across another Relation. Helps to get related Values in a
* multi-to-multi relationship.
- *
* @param relationNameOne
* String containing the relation name which is the combination
* of relation.title and relation.rel-entity-name as specified in
@@ -581,7 +545,6 @@ public interface Delegator {
/**
* Get the next guaranteed unique seq id from the sequence with the given
* sequence name; if the named sequence doesn't exist, it will be created
- *
* @param seqName
* The name of the sequence to get the next seq id from
* @return String with the next sequenced id for the given sequence name
@@ -591,7 +554,6 @@ public interface Delegator {
/**
* Get the next guaranteed unique seq id from the sequence with the given
* sequence name; if the named sequence doesn't exist, it will be created
- *
* @param seqName
* The name of the sequence to get the next seq id from
* @param staggerMax
@@ -606,7 +568,6 @@ public interface Delegator {
/**
* Get the next guaranteed unique seq id from the sequence with the given
* sequence name; if the named sequence doesn't exist, it will be created
- *
* @param seqName
* The name of the sequence to get the next seq id from
* @return Long with the next sequenced id for the given sequence name
@@ -616,7 +577,6 @@ public interface Delegator {
/**
* Get the next guaranteed unique seq id from the sequence with the given
* sequence name; if the named sequence doesn't exist, it will be created
- *
* @param seqName
* The name of the sequence to get the next seq id from
* @param staggerMax
@@ -631,7 +591,6 @@ public interface Delegator {
/**
* Gets the name of the server configuration that corresponds to this
* delegator
- *
* @return server configuration name
*/
String getOriginalDelegatorName();
@@ -639,7 +598,6 @@ public interface Delegator {
/**
* Get the named Related Entity for the GenericValue from the persistent
* store
- *
* @param relationName
* String containing the relation name which is the combination
* of relation.title and relation.rel-entity-name as specified in
@@ -661,7 +619,6 @@ public interface Delegator {
/**
* Get a dummy primary key for the named Related Entity for the GenericValue.
- *
* @param relationName
* String containing the relation name which is the combination
* of relation.title and relation.rel-entity-name as specified in
@@ -677,7 +634,6 @@ public interface Delegator {
/**
* Get related entity where relation is of type one, uses findByPrimaryKey
- *
* @param relationName
* String containing the relation name which is the combination
* of relation.title and relation.rel-entity-name as specified in
@@ -749,7 +705,6 @@ public interface Delegator {
/**
* Refresh the Entity for the GenericValue from the persistent store
- *
* @param value
* GenericValue instance containing the entity to refresh
*/
@@ -757,7 +712,6 @@ public interface Delegator {
/**
* Refresh the Entity for the GenericValue from the cache
- *
* @param value
* GenericValue instance containing the entity to refresh
*/
@@ -777,7 +731,6 @@ public interface Delegator {
* primary key, if will behave like the removeByAnd method. </p>
* <p>These updates all happen in one transaction, so they will either
* all succeed or all fail, if the data source supports transactions.</p>
- *
* @param dummyPKs
* Collection of GenericEntity instances containing the entities
* or by and fields to remove
@@ -790,7 +743,6 @@ public interface Delegator {
/**
* Removes/deletes Generic Entity records found by all of the specified
* fields (ie: combined using AND)
- *
* @param entityName
* The Name of the Entity as defined in the entity XML file
* @param fields
@@ -803,7 +755,6 @@ public interface Delegator {
/**
* Removes/deletes Generic Entity records found by all of the specified
* fields (ie: combined using AND)
- *
* @param entityName
* The Name of the Entity as defined in the entity XML file
* @param fields
@@ -815,7 +766,6 @@ public interface Delegator {
/**
* Removes/deletes Generic Entity records found by the condition
- *
* @param entityName
* The Name of the Entity as defined in the entity XML file
* @param condition
@@ -826,7 +776,6 @@ public interface Delegator {
/**
* Remove a Generic Entity corresponding to the primaryKey
- *
* @param primaryKey
* The primary key of the entity to remove.
* @return int representing number of rows effected by this operation
@@ -836,7 +785,6 @@ public interface Delegator {
/**
* Remove the named Related Entity for the GenericValue from the persistent
* store
- *
* @param relationName
* String containing the relation name which is the combination
* of relation.title and relation.rel-entity-name as specified in
@@ -849,7 +797,6 @@ public interface Delegator {
/**
* Remove a Generic Value from the database
- *
* @param value
* The GenericValue object of the entity to remove.
* @return int representing number of rows effected by this operation
@@ -879,7 +826,6 @@ public interface Delegator {
/**
* Store the Entity from the GenericValue to the persistent store
- *
* @param value
* GenericValue instance containing the entity
* @return int representing number of rows effected by this operation
@@ -897,7 +843,6 @@ public interface Delegator {
* will either all succeed or all fail, if the data source supports
* transactions. This is just like to othersToStore feature of the
* GenericEntity on a create or store.</p>
- *
* @param values
* List of GenericValue instances containing the entities to
* store
@@ -916,7 +861,6 @@ public interface Delegator {
* will either all succeed or all fail, if the data source supports
* transactions. This is just like to othersToStore feature of the
* GenericEntity on a create or store.</p>
- *
* @param storeOptions
* An instance of EntityStoreOptions that specifies advanced store
* options or null for default values.
@@ -930,7 +874,6 @@ public interface Delegator {
/**
* Store a group of values.
- *
* @param entityName
* The name of the Entity as defined in the entity XML file
* @param fieldsToSet
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 442014a..f677669 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
@@ -278,7 +278,6 @@ public class GenericEntity implements Map<String, Object>, LocalizedMap<Object>,
}
/**
- *
* @deprecated Use hasChanged()
*/
@Deprecated
@@ -678,7 +677,6 @@ public class GenericEntity implements Map<String, Object>, LocalizedMap<Object>,
* The field's Java data type can be either <code>String</code> or
* <code>Number</code>. Invalid Java data types will throw
* <code>IllegalArgumentException</code>.
- *
* @param name The name of the desired field
* @return A <code>TimeDuration</code> instance or <code>null</code>
*/
@@ -785,12 +783,10 @@ public class GenericEntity implements Map<String, Object>, LocalizedMap<Object>,
* and a composite of the Primary Key field values as a key. If no value is found in the
* resource then the field value is returned. Uses the default-resource-name from the entity
* definition as the resource name. To specify a resource name manually, use the other getResource method.
- *
* So, the key in the resource bundle (properties file) should be as follows:
* <entity-name>.<field-name>.<pk-field-value-1>.<pk-field-value-2>...<pk-field-value-n>
* For example:
* ProductType.description.FINISHED_GOOD
- *
* @param name The name of the field on the entity
* @param locale The locale to use when finding the ResourceBundle, if null uses the default
* locale for the current instance of Java
@@ -1352,7 +1348,6 @@ public class GenericEntity implements Map<String, Object>, LocalizedMap<Object>,
/**
* Creates a String for the entity, overrides the default toString
* This method is secure, it will not display encrypted fields
- *
*@return String corresponding to this entity
*/
@Override
@@ -1388,7 +1383,6 @@ public class GenericEntity implements Map<String, Object>, LocalizedMap<Object>,
/**
* Creates a String for the entity, overrides the default toString
* This method is NOT secure, it WILL display encrypted fields
- *
*@return String corresponding to this entity
*/
public String toStringInsecure() {
@@ -1598,7 +1592,6 @@ public class GenericEntity implements Map<String, Object>, LocalizedMap<Object>,
/**
* Checks to see if all foreign key records exist in the database. Will create a dummy value for
* those missing when specified.
- *
* @param insertDummy Create a dummy record using the provided fields
* @return true if all FKs exist (or when all missing are created)
* @throws GenericEntityException
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericValue.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericValue.java
index ca4e60c..b29f7e0 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericValue.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericValue.java
@@ -94,7 +94,6 @@ public class GenericValue extends GenericEntity {
/**
* Get the named Related Entity for the GenericValue from the persistent store
- *
* @param relationName String containing the relation name which is the combination of relation.title and relation.rel-entity-name as specified
* in the entity XML definition file
* @return List of GenericValue instances as specified in the relation definition
@@ -108,7 +107,6 @@ public class GenericValue extends GenericEntity {
/**
* Get the named Related Entity for the GenericValue from the persistent store
- *
* @param relationName String containing the relation name which is the combination of relation.title and relation.rel-entity-name as specified
* in the entity XML definition file
* @param orderBy The fields of the named entity to order the query by; may be null;
@@ -124,7 +122,6 @@ public class GenericValue extends GenericEntity {
/**
* Get the named Related Entity for the GenericValue from the persistent store
- *
* @param relationName String containing the relation name which is the combination of relation.title and relation.rel-entity-name as specified
* in the entity XML definition file
* @param byAndFields the fields that must equal in order to keep; may be null
@@ -142,7 +139,6 @@ public class GenericValue extends GenericEntity {
/**
* Get the named Related Entity for the GenericValue from the persistent store
- *
* @param relationName String containing the relation name which is the combination of relation.title and relation.rel-entity-name as specified
* in the entity XML definition file
* @param byAndFields the fields that must equal in order to keep; may be null
@@ -159,7 +155,6 @@ public class GenericValue extends GenericEntity {
/**
* Get the named Related Entity for the GenericValue from the persistent store across another Relation.
* Helps to get related Values in a multi-to-multi relationship.
- *
* @param relationNameOne String containing the relation name which is the
* combination of relation.title and relation.rel-entity-name as
* specified in the entity XML definition file, for first relation
@@ -175,7 +170,6 @@ public class GenericValue extends GenericEntity {
/**
* Get the named Related Entity for the GenericValue from the persistent store across another Relation.
* Helps to get related Values in a multi-to-multi relationship.
- *
* @param relationNameOne String containing the relation name which is the
* combination of relation.title and relation.rel-entity-name as
* specified in the entity XML definition file, for first relation
@@ -188,7 +182,6 @@ public class GenericValue extends GenericEntity {
/**
* Get the named Related Entity for the GenericValue from the persistent store
- *
* @param relationName String containing the relation name which is the combination of relation.title and relation.rel-entity-name as specified
* in the entity XML definition file
* @return List of GenericValue instances as specified in the relation definition
@@ -202,7 +195,6 @@ public class GenericValue extends GenericEntity {
/**
* Get the named Related Entity for the GenericValue from the persistent store
- *
* @param relationName String containing the relation name which is the combination of relation.title and relation.rel-entity-name as specified
* in the entity XML definition file
* @param useCache Whether to cache the results
@@ -214,7 +206,6 @@ public class GenericValue extends GenericEntity {
/**
* Remove the named Related Entity for the GenericValue from the persistent store
- *
* @param relationName String containing the relation name which is the combination of relation.title and relation.rel-entity-name as specified
* in the entity XML definition file
*/
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 4fe0dda..0e53cdf 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
@@ -49,7 +49,6 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Constructs a condition expression to represent a comparison between two elements.
- *
* @param lhs the left hand side element
* @param operator the binary infix operator
* @param rhs the right hand side element
@@ -61,7 +60,6 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Constructs a condition expression to represent a equality comparison between a field and a value.
- *
* @param fieldName the name of the field to compare
* @param value the value to find in field
* @return a condition expression representing a equality comparison
@@ -72,7 +70,6 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Constructs a condition expression to represent a combination of two condition expressions.
- *
* @param lhs the left hand side condition
* @param operator the binary infix operator used to combine {@code lhs} and {@code rhs} conditions
* @param rhs the right hand side condition
@@ -84,7 +81,6 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Constructs a condition expression to represent a combination of condition expressions.
- *
* @param operator the binary infix operator used to join every elements of {@code conditionList}
* @param conditionList the list of condition expressions to join
* @return a condition expression representing a combination of condition expressions.
@@ -97,7 +93,6 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Constructs a condition expression to represent a conjunction of condition expressions
- *
* @param conditionList the condition expressions to join with {@link EntityOperator#AND}
* @return a condition expression representing a conjunction of condition expressions
*/
@@ -109,7 +104,6 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Constructs a condition expression to represent a combination of condition expressions.
- *
* @param conditionList the list of condition expressions to join
* @param operator the binary infix operator used to join every elements of {@code conditionList}
* @return a condition expression representing a combination of condition expressions.
@@ -121,7 +115,6 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Constructs a condition expression to represent a conjunction of condition expressions
- *
* @param conditionList the condition expressions to join with {@link EntityOperator#AND}
* @return a condition expression representing a conjunction of condition expressions
*/
@@ -131,7 +124,6 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Constructs a condition expression to represent a combination of field/value comparisons.
- *
* @param fieldMap the map associating a field to the value to match
* @param compOp the binary infix operator used to compare the field and the value
* @param joinOp the binary infix operator used to join the field/value comparisons
@@ -144,7 +136,6 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Constructs a condition expression to represent a combination of field/value equality comparisons.
- *
* @param fieldMap the map associating a field to the value to match with {@link EntityOperator#EQUALS}
* @param joinOp the binary infix operator used to join the field/value equality comparisons
* @return a condition expression representing a combination of field/value equality comparisons
@@ -155,7 +146,6 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Constructs a condition expression to represent a conjunction of field/value equality comparisons.
- *
* @param fieldMap the map associating a field to the value to match with {@link EntityOperator#EQUALS}
* @return a condition expression representing a conjunction of field/value equality comparisons
*/
@@ -165,7 +155,6 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Constructs a condition expression to represent a combination of field/value comparisons.
- *
* @param compOp the binary infix operator used to compare the field and the value
* @param joinOp the binary infix operator used to join the field/value comparisons
* @param keysValues the field/values pairs to match
@@ -178,7 +167,6 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Constructs a condition expression to represent a combination of field/value equality comparisons.
- *
* @param joinOp the binary infix operator used to join the field/value equality comparisons
* @param keysValues the field/values pairs to match with {@link EntityOperator#EQUALS}
* @return a condition expression representing a combination of field/value equality comparisons
@@ -189,7 +177,6 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Constructs a condition expression to represent a conjunction of field/value equality comparisons.
- *
* @param keysValues the field/values pairs to match with {@link EntityOperator#EQUALS}
* @return a condition expression representing a conjunction of field/value equality comparisons
*/
@@ -199,10 +186,8 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Constructs a condition expression to filter rows that are currently valid.
- *
* This means that we remove rows whose from/thru date range does not match the current date.
* The <i>current date</i> is the one computed when the SQL query is generated.
- *
* @param fromDateName the name of the field corresponding to the from date
* @param thruDateName the name of the field corresponding to the thru date
* @return a condition expression filtering rows that are currently valid
@@ -213,7 +198,6 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Constructs a condition expression backed by a raw SQL string
- *
* @param sqlString the SQL string
* @return a raw SQL string condition expression
*/
@@ -223,14 +207,12 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Applies a visitor to this condition.
- *
* @param visitor the visitor to be applied
*/
void accept(EntityConditionVisitor visitor);
/**
* Dumps the corresponding SQL string.
- *
* @param modelEntity the model of the entity
* @param entityConditionParams the effective parameters used to substitute '?' parameters
* @param datasourceInfo the model of the data source interpreting the SQL
@@ -241,7 +223,6 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Verifies that this condition expression is valid.
- *
* @param modelEntity the model of the entity
* @throws GenericModelException when this condition expression is not valid
*/
@@ -249,7 +230,6 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Checks that this condition expression matches a particular entity.
- *
* @param entity the entity to match
* @return {@code true} if this condition expression matches {@code entity}
*/
@@ -259,7 +239,6 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Checks that this condition expression matches a particular entity.
- *
* @param delegator the delegator used to match
* @param map the entity definition to match
* @return {@code true} if this condition expression matches {@code map} when using {@code delegator}
@@ -268,14 +247,12 @@ public interface EntityCondition extends IsEmpty, Serializable {
/**
* Create a Frozen condition expression corresponding to this condition expression.
- *
* @return the frozen condition expression
*/
EntityCondition freeze();
/**
* Dumps the corresponding SQL string without substituting '?' parameters.
- *
* @return the corresponding SQL string
*/
default String makeWhereString() {
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionList.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionList.java
index 4ad3f36..09fec70 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionList.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionList.java
@@ -33,7 +33,6 @@ import java.util.List;
public final class EntityConditionList<T extends EntityCondition> extends EntityConditionListBase<T> {
/**
* Constructs an entity condition list.
- *
* @param conditionList the list of conditions
* @param operator the operator used to join the list of conditions
*/
@@ -43,7 +42,6 @@ public final class EntityConditionList<T extends EntityCondition> extends Entity
/**
* Provides the size of the internal list of condition expressions.
- *
* @return the size of the internal list of condition expressions
*/
public int getConditionListSize() {
@@ -52,7 +50,6 @@ public final class EntityConditionList<T extends EntityCondition> extends Entity
/**
* Provides an iterator to iterate on the internal list of condition expressions.
- *
* @return an iterator iterating on the internal list of condition expressions
*/
@SuppressWarnings("unchecked")
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionListBase.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionListBase.java
index 6609e0a..178865e 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionListBase.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionListBase.java
@@ -40,7 +40,6 @@ abstract class EntityConditionListBase<T extends EntityCondition> implements Ent
/**
* Constructs a combination of multiple condition expressions.
- *
* @param conditions the list of condition expressions to combine
* @param operator the infix operator used to combine every elements in the list of conditions
*/
@@ -51,7 +50,6 @@ abstract class EntityConditionListBase<T extends EntityCondition> implements Ent
/**
* Gets the infix operator used to combine every elements in the list of conditions.
- *
* @return the infix operator used to combine every elements in the list of conditions.
*/
public EntityJoinOperator getOperator() {
@@ -60,7 +58,6 @@ abstract class EntityConditionListBase<T extends EntityCondition> implements Ent
/**
* Gets the condition expression stored at a particular of the internal list of conditions.
- *
* @param index the index of the condition expression to find
* @return the corresponding condition expression
*/
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionUtils.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionUtils.java
index c79e228..7742bc0 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionUtils.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionUtils.java
@@ -31,7 +31,6 @@ final class EntityConditionUtils {
/**
* Calls {@link ModelEntity#getField(String)} if the entity model is not null.
- *
* @param modelEntity the entity model to query
* @param fieldName the name of the field to get from {@code ModelEntity}
* @return the field corresponding to {@code fieldName} in {@code ModelEntity}
@@ -43,7 +42,6 @@ final class EntityConditionUtils {
/**
* Calls {@link SqlJdbcUtil#addValue(StringBuilder, ModelField, Object, List)}
* if the condition parameters are not null.
- *
* @param buffer the buffer that will receive the SQL dump
* @param field the field to dump
* @param value the value to dump
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionVisitor.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionVisitor.java
index 595173f..69dfdbf 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionVisitor.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionVisitor.java
@@ -105,7 +105,6 @@ package org.apache.ofbiz.entity.condition;
public interface EntityConditionVisitor {
/**
* Visits an entity NOT expression.
- *
* @param cond the visited class
* @see EntityNotCondition
*/
@@ -113,7 +112,6 @@ public interface EntityConditionVisitor {
/**
* Visits a list of entity conditions.
- *
* @param l the visited class
* @see EntityConditionList
*/
@@ -121,7 +119,6 @@ public interface EntityConditionVisitor {
/**
* Visits a map of entity fields.
- *
* @param m the visited class
* @see EntityFieldMap
*/
@@ -129,7 +126,6 @@ public interface EntityConditionVisitor {
/**
* Visits a date filter condition.
- *
* @param df the visited class
* @see EntityDateFilterCondition
*/
@@ -137,7 +133,6 @@ public interface EntityConditionVisitor {
/**
* Visits an entity expression.
- *
* @param expr the visited class
* @see EntityExpr
*/
@@ -145,7 +140,6 @@ public interface EntityConditionVisitor {
/**
* Visits a raw string condition.
- *
* @param ws the visited class
* @see EntityWhereString
*/
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityDateFilterCondition.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityDateFilterCondition.java
index ce754fe..c3055a7 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityDateFilterCondition.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityDateFilterCondition.java
@@ -43,10 +43,8 @@ public final class EntityDateFilterCondition implements EntityCondition {
/**
* Constructs a condition expression to filter rows that are currently valid.
- *
* This means that we remove rows whose from/thru date range does not match the current date.
* The <i>current date</i> is the one computed when the SQL query is generated.
- *
* @param fromDateName the name of the field corresponding to the from date
* @param thruDateName the name of the field corresponding to the thru date
*/
@@ -109,7 +107,6 @@ public final class EntityDateFilterCondition implements EntityCondition {
/**
* Constructs a condition expression to filter rows that are valid now.
- *
* @return a condition expression filtering rows that are currently valid
*/
private EntityCondition makeCondition() {
@@ -118,9 +115,7 @@ public final class EntityDateFilterCondition implements EntityCondition {
/**
* Constructs a condition expression to filter rows that are valid at a given time stamp.
- *
* This means that we remove rows whose from/thru date range does not match the time stamp.
- *
* @param moment the time stamp used to check validity
* @param fromDateName the name of the field corresponding to the from date
* @param thruDateName the name of the field corresponding to the thru date
@@ -147,7 +142,6 @@ public final class EntityDateFilterCondition implements EntityCondition {
* - fromDate is null and thruDate is equal to or after rangeStart
* - thruDate is null and fromDate is before rangeEnd
* - fromDate is null and thruDate is null
- *
* @param rangeStart The start of the range to filter against
* @param rangeEnd The end of the range to filter against
* @param fromDateName The name of the field containing the entity's "fromDate"
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityExpr.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityExpr.java
index 405d867..4768ece 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityExpr.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityExpr.java
@@ -51,7 +51,6 @@ public final class EntityExpr implements EntityCondition {
/**
* Constructs an infix comparison expression.
- *
* @param lhs the left hand side of the expression
* @param operator the comparison operator used to compare the two sides of the expression
* @param rhs the right hand side of the expression
@@ -84,7 +83,6 @@ public final class EntityExpr implements EntityCondition {
/**
* Constructs an simple combination of expression.
- *
* @param lhs the expression of the left hand side
* @param operator the operator used to join the {@code lhs} and {@code rhs} expressions
* @param rhs the expression of the right hand side
@@ -108,7 +106,6 @@ public final class EntityExpr implements EntityCondition {
/**
* Gets the left hand side of the condition expression.
- *
* @return the left hand side of the condition expression
*/
public Object getLhs() {
@@ -117,7 +114,6 @@ public final class EntityExpr implements EntityCondition {
/**
* Gets the operator used to combine the two sides of the condition expression.
- *
* @return the operator used to combine the two sides of the condition expression.
*/
public <L, R> EntityOperator<L, R> getOperator() {
@@ -126,7 +122,6 @@ public final class EntityExpr implements EntityCondition {
/**
* Gets the right hand side of the condition expression.
- *
* @return the right hand side of the condition expression
*/
public Object getRhs() {
@@ -173,7 +168,6 @@ public final class EntityExpr implements EntityCondition {
// TODO: Expand the documentation to explain what is exactly checked.
/**
* Ensures that the right hand side of the condition expression is valid.
- *
* @param modelEntity the entity model used to check the condition expression
* @param delegator the delegator used to check the condition expression
*/
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFieldMap.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFieldMap.java
index ce0b4a7..2cff636 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFieldMap.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFieldMap.java
@@ -45,7 +45,6 @@ public final class EntityFieldMap extends EntityConditionListBase<EntityExpr> {
/**
* Converts a map of condition fields into a list of condition expression.
- *
* @param fieldMap the condition fields
* @param op the operator used to compared each entry in the condition field map.
* @return a list of condition expression
@@ -60,7 +59,6 @@ public final class EntityFieldMap extends EntityConditionListBase<EntityExpr> {
/**
* Constructs a map of fields.
- *
* @param compOp the operator used to compare fields
* @param joinOp the operator used to join field comparisons
* @param keysValues a list of values that the field map will contain.
@@ -75,7 +73,6 @@ public final class EntityFieldMap extends EntityConditionListBase<EntityExpr> {
/**
* Constructs a map of fields.
- *
* @param fieldMap the map containing the fields to compare
* @param compOp the operator to compare fields
* @param joinOp the operator to join entries in the field map
@@ -89,7 +86,6 @@ public final class EntityFieldMap extends EntityConditionListBase<EntityExpr> {
/**
* Gets the value associated with field {@code name}.
- *
* @param name the name of the field
* @return the value associated with field {@code name}
* @throws NullPointerException if the specified name is {@code null}
@@ -101,7 +97,6 @@ public final class EntityFieldMap extends EntityConditionListBase<EntityExpr> {
/**
* Checks if the field map contains the field {@code name}.
- *
* @param name the name of the field to search
* @return {@code true} if field is defined in the field map
* @throws NullPointerException if the specified name is {@code null}
@@ -113,7 +108,6 @@ public final class EntityFieldMap extends EntityConditionListBase<EntityExpr> {
/**
* Provides an iterator on the fields contained in the field map.
- *
* @return an iterator of fields
*/
public Iterator<String> getFieldKeyIterator() {
@@ -122,7 +116,6 @@ public final class EntityFieldMap extends EntityConditionListBase<EntityExpr> {
/**
* Provides an iterator on the entries contained in the field map.
- *
* @return an iterator of field entries
*/
public Iterator<Map.Entry<String, ? extends Object>> getFieldEntryIterator() {
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 542ae32..91b4495 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
@@ -88,7 +88,6 @@ public abstract class EntityFunction<T extends Comparable<?>> extends EntityCond
/**
* Length() entity function.
- *
*/
public static class LENGTH extends EntityFunctionSingle<Integer> {
public static final Fetcher<Integer> FETCHER = value -> value.toString().length();
@@ -100,7 +99,6 @@ public abstract class EntityFunction<T extends Comparable<?>> extends EntityCond
/**
* Trim() entity function.
- *
*/
public static class TRIM extends EntityFunctionSingle<String> {
public static final Fetcher<String> FETCHER = value -> value.toString().trim();
@@ -112,7 +110,6 @@ public abstract class EntityFunction<T extends Comparable<?>> extends EntityCond
/**
* Upper() entity function.
- *
*/
public static class UPPER extends EntityFunctionSingle<String> {
public static final Fetcher<String> FETCHER = value -> value.toString().toUpperCase(Locale.getDefault());
@@ -124,7 +121,6 @@ public abstract class EntityFunction<T extends Comparable<?>> extends EntityCond
/**
* Lower() entity function.
- *
*/
public static class LOWER extends EntityFunctionSingle<String> {
public static final Fetcher<String> FETCHER = value -> value.toString().toLowerCase(Locale.getDefault());
@@ -146,11 +142,11 @@ public abstract class EntityFunction<T extends Comparable<?>> extends EntityCond
}
}
- protected final SQLFunction function;
- protected final EntityConditionValue nested;
- protected final Object value;
- protected final Fetcher<T> fetcher;
- protected ModelField field;
+ private final SQLFunction function;
+ private final EntityConditionValue nested;
+ private final Object value;
+ private ModelField field;
+ private final Fetcher<T> fetcher;
protected EntityFunction(Fetcher<T> fetcher, SQLFunction function, EntityConditionValue nested) {
this.fetcher = fetcher;
@@ -174,19 +170,31 @@ public abstract class EntityFunction<T extends Comparable<?>> extends EntityCond
@Override
public EntityConditionValue freeze() {
if (nested != null) {
- return new EntityFunctionNested<T>(fetcher, function, nested.freeze()) {};
+ return new EntityFunctionNested<T>(fetcher, function, nested.freeze()) { };
}
- return new EntityFunctionSingle<T>(fetcher, function, value) {};
+ return new EntityFunctionSingle<T>(fetcher, function, value) { };
}
+ /**
+ * Gets code.
+ * @return the code
+ */
public String getCode() {
return function.name();
}
+ /**
+ * Gets original value.
+ * @return the original value
+ */
public Object getOriginalValue() {
return this.value;
}
+ /**
+ * Gets id.
+ * @return the id
+ */
public int getId() {
return function.ordinal();
}
@@ -208,7 +216,8 @@ public abstract class EntityFunction<T extends Comparable<?>> extends EntityCond
}
@Override
- public void addSqlValue(StringBuilder sql, Map<String, String> tableAliases, ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, boolean includeTableNamePrefix, Datasource datasourceinfo) {
+ public void addSqlValue(StringBuilder sql, Map<String, String> tableAliases, ModelEntity modelEntity,
+ List<EntityConditionParam> entityConditionParams, boolean includeTableNamePrefix, Datasource datasourceinfo) {
sql.append(function.name()).append('(');
if (nested != null) {
nested.addSqlValue(sql, tableAliases, modelEntity, entityConditionParams, includeTableNamePrefix, datasourceinfo);
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityNotCondition.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityNotCondition.java
index 6daac39..dde8acd 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityNotCondition.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityNotCondition.java
@@ -37,7 +37,6 @@ public class EntityNotCondition implements EntityCondition {
/**
* Instantiates a negation condition expression.
- *
* @param cond the condition to negate
*/
public EntityNotCondition(EntityCondition cond) {
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 ef33691..915e8f4 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
@@ -97,7 +97,8 @@ public abstract class EntityOperator<L, R> implements Serializable {
public boolean compare(Comparable<Object> lhs, Object rhs) {
return EntityComparisonOperator.compareEqual(lhs, rhs); }
@Override
- protected void makeRHSWhereString(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sb, ModelField field, Object rhs, Datasource datasourceInfo) {
+ protected void makeRHSWhereString(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sb, ModelField field,
+ Object rhs, Datasource datasourceInfo) {
if (rhs == null || rhs == GenericEntity.NULL_FIELD) {
sb.append(" IS NULL");
} else {
@@ -114,7 +115,8 @@ public abstract class EntityOperator<L, R> implements Serializable {
public boolean compare(Comparable<Object> lhs, Object rhs) {
return EntityComparisonOperator.compareNotEqual(lhs, rhs); }
@Override
- protected void makeRHSWhereString(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sb, ModelField field, Object rhs, Datasource datasourceInfo) {
+ protected void makeRHSWhereString(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sb, ModelField field,
+ Object rhs, Datasource datasourceInfo) {
if (rhs == null || rhs == GenericEntity.NULL_FIELD) {
sb.append(" IS NOT NULL");
} else {
@@ -158,7 +160,8 @@ public abstract class EntityOperator<L, R> implements Serializable {
register("greaterThan", GREATER_THAN); }
static {
register(">", GREATER_THAN); }
- public static final EntityComparisonOperator<?, ?> LESS_THAN_EQUAL_TO = new ComparableEntityComparisonOperator<Object>(ID_LESS_THAN_EQUAL_TO, "<=") {
+ public static final EntityComparisonOperator<?, ?> LESS_THAN_EQUAL_TO = new ComparableEntityComparisonOperator<Object>(ID_LESS_THAN_EQUAL_TO,
+ "<=") {
@Override
public boolean compare(Comparable<Object> lhs, Object rhs) {
return EntityComparisonOperator.compareLessThanEqualTo(lhs, rhs); }
@@ -171,7 +174,8 @@ public abstract class EntityOperator<L, R> implements Serializable {
register("lessThanEqualTo", LESS_THAN_EQUAL_TO); }
static {
register("<=", LESS_THAN_EQUAL_TO); }
- public static final EntityComparisonOperator<?, ?> GREATER_THAN_EQUAL_TO = new ComparableEntityComparisonOperator<Object>(ID_GREATER_THAN_EQUAL_TO, ">=") {
+ public static final EntityComparisonOperator<?, ?> GREATER_THAN_EQUAL_TO = new ComparableEntityComparisonOperator<Object>(ID_GREATER_THAN_EQUAL_TO,
+ ">=") {
@Override
public boolean compare(Comparable<Object> lhs, Object rhs) {
return EntityComparisonOperator.compareGreaterThanEqualTo(lhs, rhs); }
@@ -189,7 +193,9 @@ public abstract class EntityOperator<L, R> implements Serializable {
public boolean compare(Comparable<Object> lhs, Collection<Comparable<Object>> rhs) {
return EntityComparisonOperator.compareIn(lhs, rhs); }
@Override
- protected void makeRHSWhereStringValue(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sb, ModelField field, Collection<Comparable<Object>> rhs, Datasource datasourceInfo) { appendRHSList(entityConditionParams, sb, field, rhs); }
+ protected void makeRHSWhereStringValue(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sb,
+ ModelField field, Collection<Comparable<Object>> rhs, Datasource datasourceInfo) {
+ appendRHSList(entityConditionParams, sb, field, rhs); }
};
static {
register("in", IN); }
@@ -198,7 +204,9 @@ public abstract class EntityOperator<L, R> implements Serializable {
public boolean compare(Comparable<Object> lhs, Collection<Comparable<Object>> rhs) {
return EntityComparisonOperator.compareIn(lhs, rhs); }
@Override
- protected void makeRHSWhereStringValue(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sb, ModelField field, Collection<Comparable<Object>> rhs, Datasource datasourceInfo) { appendRHSBetweenList(entityConditionParams, sb, field, rhs); }
+ protected void makeRHSWhereStringValue(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sb,
+ ModelField field, Collection<Comparable<Object>> rhs, Datasource datasourceInfo) {
+ appendRHSBetweenList(entityConditionParams, sb, field, rhs); }
};
static {
register("between", BETWEEN); }
@@ -237,7 +245,9 @@ public abstract class EntityOperator<L, R> implements Serializable {
return !EntityComparisonOperator.compareIn(lhs, rhs);
}
@Override
- protected void makeRHSWhereStringValue(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sb, ModelField field, Collection<Comparable<Object>> rhs, Datasource datasourceInfo) { appendRHSList(entityConditionParams, sb, field, rhs); }
+ protected void makeRHSWhereStringValue(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sb,
+ ModelField field, Collection<Comparable<Object>> rhs, Datasource datasourceInfo) {
+ appendRHSList(entityConditionParams, sb, field, rhs); }
};
static {
register("not-in", NOT_IN);
@@ -251,6 +261,10 @@ public abstract class EntityOperator<L, R> implements Serializable {
codeString = code;
}
+ /**
+ * Gets code.
+ * @return the code
+ */
public String getCode() {
if (codeString == null) {
return "null";
@@ -258,6 +272,10 @@ public abstract class EntityOperator<L, R> implements Serializable {
return codeString;
}
+ /**
+ * Gets id.
+ * @return the id
+ */
public int getId() {
return idInt;
}
@@ -285,10 +303,24 @@ public abstract class EntityOperator<L, R> implements Serializable {
return false;
}
+ /**
+ * Entity matches boolean.
+ * @param entity the entity
+ * @param lhs the lhs
+ * @param rhs the rhs
+ * @return the boolean
+ */
public boolean entityMatches(GenericEntity entity, L lhs, R rhs) {
return mapMatches(entity.getDelegator(), entity, lhs, rhs);
}
+ /**
+ * Append rhs list.
+ * @param entityConditionParams the entity condition params
+ * @param whereStringBuilder the where string builder
+ * @param field the field
+ * @param rhs the rhs
+ */
protected void appendRHSList(List<EntityConditionParam> entityConditionParams, StringBuilder whereStringBuilder, ModelField field, R rhs) {
whereStringBuilder.append('(');
@@ -309,7 +341,16 @@ public abstract class EntityOperator<L, R> implements Serializable {
whereStringBuilder.append(')');
}
- protected <X> void appendRHSBetweenList(List<EntityConditionParam> entityConditionParams, StringBuilder whereStringBuilder, ModelField field, X rhs) {
+ /**
+ * Append rhs between list.
+ * @param <X> the type parameter
+ * @param entityConditionParams the entity condition params
+ * @param whereStringBuilder the where string builder
+ * @param field the field
+ * @param rhs the rhs
+ */
+ protected <X> void appendRHSBetweenList(List<EntityConditionParam> entityConditionParams, StringBuilder whereStringBuilder,
+ ModelField field, X rhs) {
if (rhs instanceof Collection<?>) {
Iterator<R> rhsIter = UtilGenerics.<Collection<R>>cast(rhs).iterator();
@@ -334,11 +375,23 @@ public abstract class EntityOperator<L, R> implements Serializable {
public abstract boolean isEmpty(L lhs, R rhs);
public abstract boolean mapMatches(Delegator delegator, Map<String, ? extends Object> map, L lhs, R rhs);
public abstract void validateSql(ModelEntity entity, L lhs, R rhs) throws GenericModelException;
- public void addSqlValue(StringBuilder sql, ModelEntity entity, List<EntityConditionParam> entityConditionParams, L lhs, R rhs, Datasource datasourceInfo) {
+
+ /**
+ * Add sql value.
+ * @param sql the sql
+ * @param entity the entity
+ * @param entityConditionParams the entity condition params
+ * @param lhs the lhs
+ * @param rhs the rhs
+ * @param datasourceInfo the datasource info
+ */
+ public void addSqlValue(StringBuilder sql, ModelEntity entity, List<EntityConditionParam> entityConditionParams, L lhs, R rhs,
+ Datasource datasourceInfo) {
addSqlValue(sql, entity, entityConditionParams, true, lhs, rhs, datasourceInfo);
}
- public abstract void addSqlValue(StringBuilder sql, ModelEntity entity, List<EntityConditionParam> entityConditionParams, boolean compat, L lhs, R rhs, Datasource datasourceInfo);
+ public abstract void addSqlValue(StringBuilder sql, ModelEntity entity, List<EntityConditionParam> entityConditionParams, boolean compat,
+ L lhs, R rhs, Datasource datasourceInfo);
public abstract EntityCondition freeze(L lhs, R rhs);
public static final Comparable<?> WILDCARD = new Comparable<Object>() {
@@ -358,7 +411,6 @@ public abstract class EntityOperator<L, R> implements Serializable {
/**
* Comparison operator for <code>Collection</code> types.
- *
* @param <E>
*/
public abstract static class CollectionEntityComparisonOperator<E> extends EntityComparisonOperator<Comparable<E>, Collection<Comparable<E>>> {
@@ -369,7 +421,6 @@ public abstract class EntityOperator<L, R> implements Serializable {
/**
* Comparison operator for <code>Comparable</code> types.
- *
* @param <E>
*/
public abstract static class ComparableEntityComparisonOperator<E> extends EntityComparisonOperator<Comparable<E>, E> {
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityWhereString.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityWhereString.java
index 4a2a651..67baa5c 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityWhereString.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityWhereString.java
@@ -48,7 +48,6 @@ public final class EntityWhereString implements EntityCondition {
/**
* Constructs a raw SQL string condition expression.
- *
* @param sqlString the raw SQL to embed in a condition expression
*/
public EntityWhereString(String sqlString) {
@@ -81,7 +80,6 @@ public final class EntityWhereString implements EntityCondition {
/**
* Provides access to the embedded raw SQL string.
- *
* @return the corresponding SQL string
*/
public String getWhereString() {
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityConfig.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityConfig.java
index 1596720..4f911ea 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityConfig.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityConfig.java
@@ -342,11 +342,9 @@ public final class EntityConfig {
/**
* Returns the configured JDBC password.
- *
* @param inlineJdbcElement
* @return The configured JDBC password.
* @throws GenericEntityConfException If the password was not found.
- *
* @see <code>entity-config.xsd</code>
*/
public static String getJdbcPassword(InlineJdbc inlineJdbcElement) throws GenericEntityConfException {
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java
index 3049e9a..77073b8 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java
@@ -594,7 +594,6 @@ public class GenericDAO {
/**
* Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details.
- *
* @param modelEntity The ModelEntity of the Entity as defined in the entity XML file
* @param whereEntityCondition The EntityCondition object that specifies how to constrain this query before any groupings are done (if this is
* a view entity with group-by aliases)
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 d5ee0c8..7cbc135 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
@@ -67,71 +67,71 @@ import org.apache.ofbiz.entity.transaction.TransactionUtil;
public class DatabaseUtil {
private static final String MODULE = DatabaseUtil.class.getName();
- private static final List<Detection> detections = new ArrayList<>();
- private static final String goodFormatStr;
- private static final String badFormatStr;
+ private static final List<Detection> DETECTIONS = new ArrayList<>();
+ private static final String GOOD_FORMAT_STR;
+ private static final String BAD_FORMAT_STR;
static {
try {
- detections.add(new Detection("supports transactions", true, "supportsTransactions"));
- detections.add(new Detection("isolation None", false, "supportsTransactionIsolationLevel", Connection.TRANSACTION_NONE));
- detections.add(new Detection("isolation ReadCommitted", false, "supportsTransactionIsolationLevel",
+ DETECTIONS.add(new Detection("supports transactions", true, "supportsTransactions"));
+ DETECTIONS.add(new Detection("isolation None", false, "supportsTransactionIsolationLevel", Connection.TRANSACTION_NONE));
+ DETECTIONS.add(new Detection("isolation ReadCommitted", false, "supportsTransactionIsolationLevel",
Connection.TRANSACTION_READ_COMMITTED));
- detections.add(new Detection("isolation ReadUncommitted", false, "supportsTransactionIsolationLevel",
+ DETECTIONS.add(new Detection("isolation ReadUncommitted", false, "supportsTransactionIsolationLevel",
Connection.TRANSACTION_READ_UNCOMMITTED));
- detections.add(new Detection("isolation RepeatableRead", false, "supportsTransactionIsolationLevel",
+ DETECTIONS.add(new Detection("isolation RepeatableRead", false, "supportsTransactionIsolationLevel",
Connection.TRANSACTION_REPEATABLE_READ));
- detections.add(new Detection("isolation Serializable", false, "supportsTransactionIsolationLevel", Connection.TRANSACTION_SERIALIZABLE));
- detections.add(new Detection("forward only type", false, "supportsResultSetType", ResultSet.TYPE_FORWARD_ONLY));
- detections.add(new Detection("scroll sensitive type", false, "supportsResultSetType", ResultSet.TYPE_SCROLL_SENSITIVE));
- detections.add(new Detection("scroll insensitive type", false, "supportsResultSetType", ResultSet.TYPE_SCROLL_INSENSITIVE));
- detections.add(new Detection("is case sensitive", false, "supportsMixedCaseIdentifiers"));
- detections.add(new Detection("stores LowerCase", false, "storesLowerCaseIdentifiers"));
- detections.add(new Detection("stores MixedCase", false, "storesMixedCaseIdentifiers"));
- detections.add(new Detection("stores UpperCase", false, "storesUpperCaseIdentifiers"));
- detections.add(new Detection("max table name length", false, "getMaxTableNameLength"));
- detections.add(new Detection("max column name length", false, "getMaxColumnNameLength"));
- detections.add(new Detection("concurrent connections", false, "getMaxConnections"));
- detections.add(new Detection("concurrent statements", false, "getMaxStatements"));
- detections.add(new Detection("ANSI SQL92 Entry", false, "supportsANSI92EntryLevelSQL"));
- detections.add(new Detection("ANSI SQL92 Intermediate", false, "supportsANSI92IntermediateSQL"));
- detections.add(new Detection("ANSI SQL92 Full", false, "supportsANSI92FullSQL"));
- detections.add(new Detection("ODBC SQL Grammar Core", false, "supportsCoreSQLGrammar"));
- detections.add(new Detection("ODBC SQL Grammar Extended", false, "supportsExtendedSQLGrammar"));
- detections.add(new Detection("ODBC SQL Grammar Minimum", false, "supportsMinimumSQLGrammar"));
- detections.add(new Detection("outer joins", true, "supportsOuterJoins"));
- detections.add(new Detection("limited outer joins", false, "supportsLimitedOuterJoins"));
- detections.add(new Detection("full outer joins", false, "supportsFullOuterJoins"));
- detections.add(new Detection("group by", true, "supportsGroupBy"));
- detections.add(new Detection("group by not in select", false, "supportsGroupByUnrelated"));
- detections.add(new Detection("column aliasing", false, "supportsColumnAliasing"));
- detections.add(new Detection("order by not in select", false, "supportsOrderByUnrelated"));
- detections.add(new Detection("alter table add column", true, "supportsAlterTableWithAddColumn"));
- detections.add(new Detection("non-nullable column", true, "supportsNonNullableColumns"));
+ DETECTIONS.add(new Detection("isolation Serializable", false, "supportsTransactionIsolationLevel", Connection.TRANSACTION_SERIALIZABLE));
+ DETECTIONS.add(new Detection("forward only type", false, "supportsResultSetType", ResultSet.TYPE_FORWARD_ONLY));
+ DETECTIONS.add(new Detection("scroll sensitive type", false, "supportsResultSetType", ResultSet.TYPE_SCROLL_SENSITIVE));
+ DETECTIONS.add(new Detection("scroll insensitive type", false, "supportsResultSetType", ResultSet.TYPE_SCROLL_INSENSITIVE));
+ DETECTIONS.add(new Detection("is case sensitive", false, "supportsMixedCaseIdentifiers"));
+ DETECTIONS.add(new Detection("stores LowerCase", false, "storesLowerCaseIdentifiers"));
+ DETECTIONS.add(new Detection("stores MixedCase", false, "storesMixedCaseIdentifiers"));
+ DETECTIONS.add(new Detection("stores UpperCase", false, "storesUpperCaseIdentifiers"));
+ DETECTIONS.add(new Detection("max table name length", false, "getMaxTableNameLength"));
+ DETECTIONS.add(new Detection("max column name length", false, "getMaxColumnNameLength"));
+ DETECTIONS.add(new Detection("concurrent connections", false, "getMaxConnections"));
+ DETECTIONS.add(new Detection("concurrent statements", false, "getMaxStatements"));
+ DETECTIONS.add(new Detection("ANSI SQL92 Entry", false, "supportsANSI92EntryLevelSQL"));
+ DETECTIONS.add(new Detection("ANSI SQL92 Intermediate", false, "supportsANSI92IntermediateSQL"));
+ DETECTIONS.add(new Detection("ANSI SQL92 Full", false, "supportsANSI92FullSQL"));
+ DETECTIONS.add(new Detection("ODBC SQL Grammar Core", false, "supportsCoreSQLGrammar"));
+ DETECTIONS.add(new Detection("ODBC SQL Grammar Extended", false, "supportsExtendedSQLGrammar"));
+ DETECTIONS.add(new Detection("ODBC SQL Grammar Minimum", false, "supportsMinimumSQLGrammar"));
+ DETECTIONS.add(new Detection("outer joins", true, "supportsOuterJoins"));
+ DETECTIONS.add(new Detection("limited outer joins", false, "supportsLimitedOuterJoins"));
+ DETECTIONS.add(new Detection("full outer joins", false, "supportsFullOuterJoins"));
+ DETECTIONS.add(new Detection("group by", true, "supportsGroupBy"));
+ DETECTIONS.add(new Detection("group by not in select", false, "supportsGroupByUnrelated"));
+ DETECTIONS.add(new Detection("column aliasing", false, "supportsColumnAliasing"));
+ DETECTIONS.add(new Detection("order by not in select", false, "supportsOrderByUnrelated"));
+ DETECTIONS.add(new Detection("alter table add column", true, "supportsAlterTableWithAddColumn"));
+ DETECTIONS.add(new Detection("non-nullable column", true, "supportsNonNullableColumns"));
//detections.add(new Detection("", false, "", ));
} catch (NoSuchMethodException e) {
throw (InternalError) new InternalError(e.getMessage()).initCause(e);
}
int maxWidth = 0;
- for (Detection detection : detections) {
+ for (Detection detection : DETECTIONS) {
if (detection.name.length() > maxWidth) {
maxWidth = detection.name.length();
}
}
- goodFormatStr = "- %-" + maxWidth + "s [%s]%s";
- badFormatStr = "- %-" + maxWidth + "s [ DETECTION FAILED ]%s";
+ GOOD_FORMAT_STR = "- %-" + maxWidth + "s [%s]%s";
+ BAD_FORMAT_STR = "- %-" + maxWidth + "s [ DETECTION FAILED ]%s";
}
// OFBiz Connections
- protected ModelFieldTypeReader modelFieldTypeReader = null;
- protected Datasource datasourceInfo = null;
- protected GenericHelperInfo helperInfo = null;
+ private ModelFieldTypeReader modelFieldTypeReader = null;
+ private Datasource datasourceInfo = null;
+ private GenericHelperInfo helperInfo = null;
// Legacy Connections
- protected String connectionUrl = null;
- protected String driverName = null;
- protected String userName = null;
- protected String password = null;
- boolean isLegacy = false;
+ private String connectionUrl = null;
+ private String driverName = null;
+ private String userName = null;
+ private String password = null;
+ private boolean isLegacy = false;
// OFBiz DatabaseUtil
public DatabaseUtil(GenericHelperInfo helperInfo) {
@@ -151,7 +151,8 @@ public class DatabaseUtil {
if (DriverManager.getDriver(driverName) == null) {
try {
Driver driver =
- (Driver) Class.forName(driverName, true, Thread.currentThread().getContextClassLoader()).getDeclaredConstructor().newInstance();
+ (Driver) Class.forName(driverName, true, Thread.currentThread().getContextClassLoader()).getDeclaredConstructor()
+ .newInstance();
DriverManager.registerDriver(driver);
} catch (ReflectiveOperationException e) {
Debug.logWarning(e, "Unable to load driver [" + driverName + "]", MODULE);
@@ -160,12 +161,13 @@ public class DatabaseUtil {
}
try {
- if (UtilValidate.isNotEmpty(userName))
+ if (UtilValidate.isNotEmpty(userName)) {
return DriverManager.getConnection(connectionUrl, userName, password);
- else if (props != null)
+ } else if (props != null) {
return DriverManager.getConnection(connectionUrl, props);
- else
+ } else {
return DriverManager.getConnection(connectionUrl);
+ }
} catch (SQLException e) {
Debug.logError(e, "SQL Error obtaining JDBC connection", MODULE);
throw e;
@@ -180,6 +182,12 @@ public class DatabaseUtil {
return tempName.toUpperCase();
}
+ /**
+ * Gets connection.
+ * @return the connection
+ * @throws SQLException the sql exception
+ * @throws GenericEntityException the generic entity exception
+ */
protected Connection getConnection() throws SQLException, GenericEntityException {
Connection connection = null;
if (!isLegacy) {
@@ -201,6 +209,11 @@ public class DatabaseUtil {
return connection;
}
+ /**
+ * Gets connection logged.
+ * @param messages the messages
+ * @return the connection logged
+ */
protected Connection getConnectionLogged(Collection<String> messages) {
try {
return getConnection();
@@ -213,16 +226,36 @@ public class DatabaseUtil {
}
}
+ /**
+ * Gets datasource.
+ * @return the datasource
+ */
public Datasource getDatasource() {
return this.datasourceInfo;
}
+ /**
+ * Check db.
+ * @param modelEntities the model entities
+ * @param messages the messages
+ * @param addMissing the add missing
+ */
public void checkDb(Map<String, ModelEntity> modelEntities, List<String> messages, boolean addMissing) {
- checkDb(modelEntities, null, messages, datasourceInfo.getCheckPksOnStart(),
- (datasourceInfo.getUseForeignKeys() && datasourceInfo.getCheckFksOnStart()),
- (datasourceInfo.getUseForeignKeyIndices() && datasourceInfo.getCheckFkIndicesOnStart()), addMissing);
+ checkDb(modelEntities, null, messages, datasourceInfo.getCheckPksOnStart(), (
+ datasourceInfo.getUseForeignKeys() && datasourceInfo.getCheckFksOnStart()), (
+ datasourceInfo.getUseForeignKeyIndices() && datasourceInfo.getCheckFkIndicesOnStart()), addMissing);
}
+ /**
+ * Check db.
+ * @param modelEntities the model entities
+ * @param colWrongSize the col wrong size
+ * @param messages the messages
+ * @param checkPks the check pks
+ * @param checkFks the check fks
+ * @param checkFkIdx the check fk idx
+ * @param addMissing the add missing
+ */
public void checkDb(Map<String, ModelEntity> modelEntities, List<String> colWrongSize, List<String> messages, boolean checkPks,
boolean checkFks, boolean checkFkIdx, boolean addMissing) {
if (isLegacy) {
@@ -390,7 +423,8 @@ public class DatabaseUtil {
Debug.logError(message, MODULE);
if (messages != null) messages.add(message);
}
- if (columnSize != -1 && ccInfo.columnSize != -1 && columnSize != ccInfo.columnSize && (columnSize * 3) != ccInfo.columnSize) {
+ if (columnSize != -1 && ccInfo.columnSize != -1 && columnSize != ccInfo.columnSize && (columnSize * 3)
+ != ccInfo.columnSize) {
String message = "Column [" + ccInfo.columnName + "] of table [" + tableName + "] of entity ["
+ entity.getEntityName() + "] has a column size of [" + ccInfo.columnSize
+ "] in the database, but is defined to have a column size of [" + columnSize + "] in the "
@@ -514,7 +548,7 @@ public class DatabaseUtil {
fkIndicesFutures.add(executor.submit(new AbstractCountingCallable(curEntity, modelEntities) {
@Override
public AbstractCountingCallable call() throws Exception {
- count = createForeignKeyIndices(entity, datasourceInfo.getConstraintNameClipLength(), messages);
+ setCount(createForeignKeyIndices(getEntity(), datasourceInfo.getConstraintNameClipLength(), messages));
return this;
}
}));
@@ -545,7 +579,7 @@ public class DatabaseUtil {
disFutures.add(executor.submit(new AbstractCountingCallable(curEntity, modelEntities) {
@Override
public AbstractCountingCallable call() throws Exception {
- count = createDeclaredIndices(entity, messages);
+ setCount(createDeclaredIndices(getEntity(), messages));
return this;
}
}));
@@ -629,7 +663,8 @@ public class DatabaseUtil {
datasourceInfo.getUseFkInitiallyDeferred());
if (UtilValidate.isNotEmpty(errMsg)) {
String message =
- "Could not create foreign key " + relConstraintName + " for entity [" + entity.getEntityName() + "]: " + errMsg;
+ "Could not create foreign key " + relConstraintName + " for entity [" + entity.getEntityName() + "]: "
+ + errMsg;
Debug.logError(message, MODULE);
if (messages != null) messages.add(message);
} else {
@@ -731,7 +766,8 @@ public class DatabaseUtil {
String errMsg = createForeignKeyIndex(entity, modelRelation, datasourceInfo.getConstraintNameClipLength());
if (UtilValidate.isNotEmpty(errMsg)) {
String message =
- "Could not create foreign key index " + relConstraintName + " for entity [" + entity.getEntityName() + "]:"
+ "Could not create foreign key index " + relConstraintName + " for entity [" + entity.getEntityName()
+ + "]:"
+ " " + errMsg;
Debug.logError(message, MODULE);
if (messages != null) messages.add(message);
@@ -884,6 +920,11 @@ public class DatabaseUtil {
return dbData;
}
+ /**
+ * Print db misc data.
+ * @param dbData the db data
+ * @param con the con
+ */
public void printDbMiscData(DatabaseMetaData dbData, Connection con) {
if (dbData == null) {
return;
@@ -908,14 +949,14 @@ public class DatabaseUtil {
}
// Db/Driver support settings
Debug.logInfo("Database Setting/Support Information (those with a * should be true):", MODULE);
- for (Detection detection : detections) {
+ for (Detection detection : DETECTIONS) {
String requiredFlag = detection.required ? "*" : "";
try {
Object result = detection.method.invoke(dbData, detection.params);
- Debug.logInfo(String.format(goodFormatStr, detection.name, result, requiredFlag), MODULE);
+ Debug.logInfo(String.format(GOOD_FORMAT_STR, detection.name, result, requiredFlag), MODULE);
} catch (Exception e) {
Debug.logVerbose(e, MODULE);
- Debug.logWarning(String.format(badFormatStr, detection.name, requiredFlag), MODULE);
+ Debug.logWarning(String.format(BAD_FORMAT_STR, detection.name, requiredFlag), MODULE);
}
}
try {
@@ -1239,7 +1280,8 @@ public class DatabaseUtil {
ColumnCheckInfo ccInfo = tableColInfo.get(columnName);
if (ccInfo == null) {
// this isn't good, what to do?
- Debug.logWarning("Got primary key information for a column that we didn't get column information for: tableName=[" + tableName + "], columnName=[" + columnName + "]", MODULE);
+ Debug.logWarning("Got primary key information for a column that we didn't get column information for: tableName=["
+ + tableName + "], columnName=[" + columnName + "]", MODULE);
continue;
}
@@ -1409,6 +1451,13 @@ public class DatabaseUtil {
return refInfo;
}
+ /**
+ * Gets index info.
+ * @param tableNames the table names
+ * @param messages the messages
+ * @param needsUpperCase the needs upper case
+ * @return the index info
+ */
public Map<String, Set<String>> getIndexInfo(Set<String> tableNames, Collection<String> messages, boolean[] needsUpperCase) {
Connection connection = getConnectionLogged(messages);
if (connection == null) {
@@ -1710,10 +1759,12 @@ public class DatabaseUtil {
}
}
- /* ====================================================================== */
-
- /* ====================================================================== */
-
+ /**
+ * Add column string.
+ * @param entity the entity
+ * @param field the field
+ * @return the string
+ */
public String addColumn(ModelEntity entity, ModelField field) {
if (entity == null || field == null)
return "ModelEntity or ModelField where null, cannot add column";
@@ -1803,8 +1854,9 @@ public class DatabaseUtil {
}
public String renameColumn(ModelEntity entity, ModelField field, String newName) {
- if (entity == null || field == null)
+ if (entity == null || field == null) {
return "ModelEntity or ModelField where null, cannot rename column";
+ }
if (entity instanceof ModelViewEntity) {
return "ERROR: Cannot rename column for a view entity";
}
@@ -1906,6 +1958,12 @@ public class DatabaseUtil {
}
}
+ /**
+ * Repair column size changes.
+ * @param modelEntities the model entities
+ * @param fieldsWrongSize the fields wrong size
+ * @param messages the messages
+ */
public void repairColumnSizeChanges(Map<String, ModelEntity> modelEntities, List<String> fieldsWrongSize, List<String> messages) {
if (modelEntities == null || UtilValidate.isEmpty(fieldsWrongSize)) {
messages.add("No fields to repair");
@@ -1924,7 +1982,13 @@ public class DatabaseUtil {
}
}
- /* ====================================================================== */
+
+ /**
+ * Make pk constraint name string.
+ * @param entity the entity
+ * @param constraintNameClipLength the constraint name clip length
+ * @return the string
+ */
public String makePkConstraintName(ModelEntity entity, int constraintNameClipLength) {
String pkName = "PK_" + entity.getPlainTableName();
@@ -1935,6 +1999,12 @@ public class DatabaseUtil {
return pkName;
}
+ /**
+ * Make fk constraint name string.
+ * @param modelRelation the model relation
+ * @param constraintNameClipLength the constraint name clip length
+ * @return the string
+ */
public String makeFkConstraintName(ModelRelation modelRelation, int constraintNameClipLength) {
String relConstraintName = modelRelation.getFkName();
@@ -1950,7 +2020,12 @@ public class DatabaseUtil {
return relConstraintName;
}
- /* ====================================================================== */
+ /**
+ * Make index name string.
+ * @param modelIndex the model index
+ * @param constraintNameClipLength the constraint name clip length
+ * @return the string
+ */
public String makeIndexName(ModelIndex modelIndex, int constraintNameClipLength) {
String indexName = modelIndex.getName();
@@ -1961,14 +2036,29 @@ public class DatabaseUtil {
return indexName;
}
- /* ====================================================================== */
- /* ====================================================================== */
+ /**
+ * Create foreign keys int.
+ * @param entity the entity
+ * @param modelEntities the model entities
+ * @param messages the messages
+ * @return the int
+ */
public int createForeignKeys(ModelEntity entity, Map<String, ModelEntity> modelEntities, List<String> messages) {
return this.createForeignKeys(entity, modelEntities, datasourceInfo.getConstraintNameClipLength(), datasourceInfo.getFkStyle(),
datasourceInfo.getUseFkInitiallyDeferred(), messages);
}
+ /**
+ * Create foreign keys int.
+ * @param entity the entity
+ * @param modelEntities the model entities
+ * @param constraintNameClipLength the constraint name clip length
+ * @param fkStyle the fk style
+ * @param useFkInitiallyDeferred the use fk initially deferred
+ * @param messages the messages
+ * @return the int
+ */
public int createForeignKeys(ModelEntity entity, Map<String, ModelEntity> modelEntities, int constraintNameClipLength, String fkStyle,
boolean useFkInitiallyDeferred, List<String> messages) {
if (entity == null) {
@@ -2027,6 +2117,16 @@ public class DatabaseUtil {
return fksCreated;
}
+ /**
+ * Create foreign key string.
+ * @param entity the entity
+ * @param modelRelation the model relation
+ * @param relModelEntity the rel model entity
+ * @param constraintNameClipLength the constraint name clip length
+ * @param fkStyle the fk style
+ * @param useFkInitiallyDeferred the use fk initially deferred
+ * @return the string
+ */
public String createForeignKey(ModelEntity entity, ModelRelation modelRelation, ModelEntity relModelEntity, int constraintNameClipLength,
String fkStyle, boolean useFkInitiallyDeferred) {
// now add constraint clause
@@ -2058,6 +2158,16 @@ public class DatabaseUtil {
return null;
}
+ /**
+ * Make fk constraint clause string.
+ * @param entity the entity
+ * @param modelRelation the model relation
+ * @param relModelEntity the rel model entity
+ * @param constraintNameClipLength the constraint name clip length
+ * @param fkStyle the fk style
+ * @param useFkInitiallyDeferred the use fk initially deferred
+ * @return the string
+ */
public String makeFkConstraintClause(ModelEntity entity, ModelRelation modelRelation, ModelEntity relModelEntity, int constraintNameClipLength,
String fkStyle, boolean useFkInitiallyDeferred) {
// make the two column lists
@@ -2068,7 +2178,8 @@ public class DatabaseUtil {
ModelField mainField = entity.getField(keyMap.getFieldName());
if (mainField == null) {
- Debug.logError("Bad key-map in entity [" + entity.getEntityName() + "] relation to [" + modelRelation.getTitle() + modelRelation.getRelEntityName() + "] for field [" + keyMap.getFieldName() + "]", MODULE);
+ Debug.logError("Bad key-map in entity [" + entity.getEntityName() + "] relation to [" + modelRelation.getTitle()
+ + modelRelation.getRelEntityName() + "] for field [" + keyMap.getFieldName() + "]", MODULE);
return null;
}
@@ -2131,10 +2242,23 @@ public class DatabaseUtil {
return sqlBuf.toString();
}
+ /**
+ * Delete foreign keys.
+ * @param entity the entity
+ * @param modelEntities the model entities
+ * @param messages the messages
+ */
public void deleteForeignKeys(ModelEntity entity, Map<String, ModelEntity> modelEntities, List<String> messages) {
this.deleteForeignKeys(entity, modelEntities, datasourceInfo.getConstraintNameClipLength(), messages);
}
+ /**
+ * Delete foreign keys.
+ * @param entity the entity
+ * @param modelEntities the model entities
+ * @param constraintNameClipLength the constraint name clip length
+ * @param messages the messages
+ */
public void deleteForeignKeys(ModelEntity entity, Map<String, ModelEntity> modelEntities, int constraintNameClipLength, List<String> messages) {
if (entity == null) {
String errMsg = "ModelEntity was null and is required to delete foreign keys for a table";
@@ -2214,9 +2338,13 @@ public class DatabaseUtil {
}
return null;
}
-
- /* ====================================================================== */
- /* ====================================================================== */
+ /**
+ * Create primary key.
+ * @param entity the entity
+ * @param usePkConstraintNames the use pk constraint names
+ * @param constraintNameClipLength the constraint name clip length
+ * @param messages the messages
+ */
public void createPrimaryKey(ModelEntity entity, boolean usePkConstraintNames, int constraintNameClipLength, List<String> messages) {
if (messages == null) messages = new ArrayList<>();
String err = createPrimaryKey(entity, usePkConstraintNames, constraintNameClipLength);
@@ -2279,6 +2407,13 @@ public class DatabaseUtil {
return message;
}
+ /**
+ * Delete primary key.
+ * @param entity the entity
+ * @param usePkConstraintNames the use pk constraint names
+ * @param constraintNameClipLength the constraint name clip length
+ * @param messages the messages
+ */
public void deletePrimaryKey(ModelEntity entity, boolean usePkConstraintNames, int constraintNameClipLength, List<String> messages) {
if (messages == null) messages = new ArrayList<>();
String err = deletePrimaryKey(entity, usePkConstraintNames, constraintNameClipLength);
@@ -2287,14 +2422,32 @@ public class DatabaseUtil {
}
}
+ /**
+ * Delete primary key.
+ * @param entity the entity
+ * @param usePkConstraintNames the use pk constraint names
+ * @param messages the messages
+ */
public void deletePrimaryKey(ModelEntity entity, boolean usePkConstraintNames, List<String> messages) {
deletePrimaryKey(entity, usePkConstraintNames, datasourceInfo.getConstraintNameClipLength(), messages);
}
+ /**
+ * Delete primary key.
+ * @param entity the entity
+ * @param messages the messages
+ */
public void deletePrimaryKey(ModelEntity entity, List<String> messages) {
deletePrimaryKey(entity, datasourceInfo.getUsePkConstraintNames(), messages);
}
+ /**
+ * Delete primary key string.
+ * @param entity the entity
+ * @param usePkConstraintNames the use pk constraint names
+ * @param constraintNameClipLength the constraint name clip length
+ * @return the string
+ */
public String deletePrimaryKey(ModelEntity entity, boolean usePkConstraintNames, int constraintNameClipLength) {
if (entity == null) {
return "ModelEntity was null and is required to delete the primary key for a table";
@@ -2441,6 +2594,11 @@ public class DatabaseUtil {
return indexSqlBuf.toString();
}
+ /**
+ * Delete declared indices.
+ * @param entity the entity
+ * @param messages the messages
+ */
public void deleteDeclaredIndices(ModelEntity entity, List<String> messages) {
if (messages == null) messages = new ArrayList<>();
String err = deleteDeclaredIndices(entity);
@@ -2449,6 +2607,11 @@ public class DatabaseUtil {
}
}
+ /**
+ * Delete declared indices string.
+ * @param entity the entity
+ * @return the string
+ */
public String deleteDeclaredIndices(ModelEntity entity) {
if (entity == null) {
return "ModelEntity was null and is required to delete declared indices for a table";
@@ -2482,6 +2645,12 @@ public class DatabaseUtil {
}
}
+ /**
+ * Delete declared index string.
+ * @param entity the entity
+ * @param modelIndex the model index
+ * @return the string
+ */
public String deleteDeclaredIndex(ModelEntity entity, ModelIndex modelIndex) {
// TODO: also remove the constraing if this was a unique index, in most databases dropping the index does not drop the constraint
@@ -2514,12 +2683,23 @@ public class DatabaseUtil {
return null;
}
- /* ====================================================================== */
- /* ====================================================================== */
+ /**
+ * Create foreign key indices int.
+ * @param entity the entity
+ * @param messages the messages
+ * @return the int
+ */
public int createForeignKeyIndices(ModelEntity entity, List<String> messages) {
return createForeignKeyIndices(entity, datasourceInfo.getConstraintNameClipLength(), messages);
}
+ /**
+ * Create foreign key indices int.
+ * @param entity the entity
+ * @param constraintNameClipLength the constraint name clip length
+ * @param messages the messages
+ * @return the int
+ */
public int createForeignKeyIndices(ModelEntity entity, int constraintNameClipLength, List<String> messages) {
if (entity == null) {
String message = "ModelEntity was null and is required to create foreign keys indices for a table";
@@ -2560,6 +2740,13 @@ public class DatabaseUtil {
return fkisCreated;
}
+ /**
+ * Create foreign key index string.
+ * @param entity the entity
... 8209 lines suppressed ...