(OFBIZ-10935)
Use ‘PoolableConnectionFactory#setAutoCommitOnReturn’ instead of
‘PoolableConnectionFactory#setEnableAutoCommitOnReturn’ from
‘org.apache.commons.dbcp2’ package.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1857898 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9855)
Uses try with resources for File IO objects like ObjectInputStream and other
objects. File classes have the AutoCloseable interface.
jleroux: this is only a part of the 2nd patch. The 1st patch will be committed
soon too...
All tests pass
Thanks: Pradhan Yash Sharma
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1857099 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10771)
The ObjectType class contains utilities that extends the Java reflection API by
defining methods which accepts string representation of Java types and classes.
It appears that this class contains unneeded code which is either dead or is
redundant with the services already defined in the reflection API
Removes the useless isOrSubOf, instanceOf and interfaceOf methods.
Additionally it removes the getInstance method which is not used anywhere in
the framework or in the plugins.
Also includes similar changes in
AbstractConverter.java
Converters.java
DateTimeConverters.java
GenericEntity.java
IfInstanceOf.java
Thanks: Mathieu
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1851701 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10691)
Unecessary ‘this’ has been removed and the javadoc has been
expanded. The visibility of the class has been reduced to package
only. The ‘conditionList’ field has been renamed to ‘conditions’ and
the subclasses has been adapted.
Thanks Mathieu for the contribution
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1850385 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10691)
Remove useless ‘this’ and useless imports. An ‘isNullField’ private
method has been addded to factorize the check of null field.
Additionally the 120 characters per line limit has been enforced.
Thanks Mathieu for the contribution
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1850384 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10691)
This class is now final. The ‘getConditionListSize’ and
‘getConditionIterator’ methods has been inlined instead of overidding
them from ‘EntityConditionListBase’. The Javadoc has been expanded.
Thanks Mathieu for the contribution
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1850377 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10691)
‘EntityConditionFunction’ was representing an expression containing a
unary prefix condition operator or in other words a one argument
predicate. Actually, there exists only one meaningful implementation
for this kind of operators in the SQL language which is the NOT·
predicate. Having a ‘EntityNotCondition’ class allows us to have
simpler semantics while achieving the same completeness in term of SQL·
support.
The ‘EntityConditionVisitor’ and its documentation has been adapted to
the new class hierarchy.
Thanks Mathieu for the contribution
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1850376 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10691)
This is done in the spirit of favouring abstraction over
implementation. To achieve that the following change has been made:
* The useless ‘EntityCondition#eval’ methods has been removed
* The ‘PriceServices#calculatePurchasePrice’ method has been fixed to
refer to ‘EntityCondition#makeCondition’ instead of
‘EntityExpr#makeCondition’.
Additionally, the genericity of the ‘makeCondition’ methods has been
improved to allow having a hierarchy of class between the
‘EntityCondition’ type and the subtypes.
Exceptionally a ‘serialVersionUID’ has been used instead of
suppressing the 'serial' warning for the ‘EntityCondition’ interface
to satisfy both Eclipse and OpenJDK linting features which disagree on
the validity of using the ‘@SuppressWarnings’ annotation in the case
of interfaces extending ‘Serializable’.
Thanks Mathieu for the contribution
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1850373 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10691)
This is removing an abuse of inheritance for code reuse which was·
breaking Liskov substitution principle. This has been achieved with
the following changes:
* The ‘Serializable’ interface which was implemented by
‘EntityConditionBase’ is now implemented directly by the·
‘EntityCondition’, ‘EntityConditionValue’, and ‘EntityOperator’
classes.
* ‘emptyList’ and ‘_emptyMap’ useless static members has been removed
and ‘emptyAliases’ has been move down to the ‘EntityConditionValue’
subclass.
* The ‘castBoolean’ method has been removed due to the automatic
boxing/unboxing of boolean and Boolean values which make it useless.
* ‘equals’ and ‘hashCode’ pseudo abstract methods (meaning methods
throwing an unsupported operation exception) has been moved down to
the ‘EntityCondition’ and ‘EntityConditionValue’ sub classes.
‘Objects#equals’ and ‘Objects#hashCode’ standard methods has been
used in the EntityCondition class hierarchy instead.
* The ‘getColName’ methods has been moved down to the·
‘EntityConditionValue’ class which is the unique class using those
methods.
* The remaining static methods ‘getField’ and ‘addValue’ has been
moved to a new ‘EntityConditionUtils’ class. The unused override of
‘addValue’ has been removed which allowed us to make this method
static.
Thanks Mathieu for the contribution
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1850372 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10763)
The use of an overridden abstract method for isEncrypted is a bit overkill and
could be replaced by a simple equality check
Thanks: Mathieu Lirzin
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1850253 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10689)
Actually this is a firts step that simply renames
ObjectType::simpleTypeConvert to
ObjectType::simpleTypeOrObjectConvert
and improves the simpleTypeOrObjectConvert Javadoc
Thanks: Pierre Smits for report, Deepak Dixit for discussion
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1850027 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10725)
Improved boolean returns with a single statement, replacing if blocks with the explicit boolean return.
Improves code in methods:
isPrimaryKey() of GenericEntity
hasNext() and hasPrevious() of EntityListIterator
isValueActive() of EntityUtil
Additional change:
Improved return for getStartIndexFromViewIndex() method in EntityUtil. Instead of using if-else block, a ternary operator is used for improving readability.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1849741 13f79535-47bb-0310-9956-ffa450edef68
EntityQuery
(OFBIZ-9890)
queryList() and queryFirst() both call internal private query() method.
This method calls delegator.findList if a normal Entity/ViewEntity is used
(not a DVE).
DVE has no option to include a having condition and so must opt to use
queryIterator(). Even queryCount() can use a having condition.
Thanks: Rupert Howell and Gareth Carter for report, Prakhar Kumar for discussion
and Gareth Carter for the fix
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1849693 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10701)
In order to detect potential issues early, the linting compiler option should be
used by default and disabled with {{./gradlew -PXlint:none build}}.
Additionally it is important to reduce the number of warnings otherwise new
warnings will remain unnoticed.
The warning related to the com.googlecode.concurrentlinkedhashmap dependency
should resolves itself once we handle upgrade to Caffeine like proposed in
OFBIZ-6747.
Thanks: Mathieu Lirzin
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1848673 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10488)
Since Java 8 it is possible to instantiate functional interfaces
(interfaces with one non-static method) with lambda expressions instead
of anonymous classes.
This replaces the creation of callable objects with lambda expressions.
Thanks: Mathieu Lirzin
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1848514 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10411)
To define boolean values, some ad-hoc enumeration of "true" and "false" are
repeatedly used. Since XML Schema defines a standard boolean datatype it's
better to use it.
Thanks: Mathieu Lirzin
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1846727 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10593)
Remove visit methods from current EntityConditionBase type hierarchy.
Add or rewrite accept method in EntityCondition type hierachy.
Add documentation in EntityConditionVisitor, introducing implementation examples.
Add junit test validating documented examples.
Thanks to Mathieu Lirzin for your contribution, and Jacques for the review.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1843780 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-10008)
No configurations is available to disable usage of EntitySyncRemove.
And it's creating problems when having a large database and frequent delete
operations.
saveEntitySyncRemoveInfo is used to create EntitySyncRemove records in
GenericDelegator.removeValue() and removeByPrimaryKey().
This adds a mechanism to prevent the usage of EntitySyncRemove by adding a
property in general.properties file used to configure in entityengine.xml
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1835296 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-7112)
Remove useless redundant code.
results map is already initialised in the beginning with isExistInDb
as "N" and value as "".
These values only changed when systemProperty != null. S
o except for this condition if we return results at any point it will have
isExistInDb as "N" and value as "".
If we remove the lines I removed in the patch, it will only remove put
operations that are not necessary.
Thanks: Aditya
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1828217 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-1032)
Karl:
Avoids rollback on create error to be able to store the entity instead
(previous mostly-inserts feature).
Matin:
I think, the data load with "mostly inserts" activated should fail on a
create-failure (what it does indeed already), so I see no need for a working
solution of a fallback store attempt. Consistently the Feature should be renamed
in the frontend from "mostly inserts" to "only inserts".
Kyra:
Additional trivial refactoring in the patch: I reduced the full qualified
classname of org.xml.sax.SAXException in method signatures to the simple name.
This incorperates the changes that Martin has mentioned above.
The unnecessary call to store() is removed, simplifying the process of creating
and deleting entities. (These changes were already in Martins old patch but had
the wrong format.) This means that the flag "mostly Inserts?" is not accurately
worded since as long as there is only create fail, all operations are rolled
back. So the second patch renames the flag and all appropriate parameters to
"onlyInserts".
jleroux: I made few no functional changes, apart not swallowing an exception
Thanks: Thanks Karl for the 1st patch, Martin to get further, and Kyra to
complete the whole with a final touch and help to quickly test
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1822310 13f79535-47bb-0310-9956-ffa450edef68