We have enabled flag in EntityEcaRule class, if its set false then entity eca rule will not be execute.
But there is not way to disable entity eca.
We can add enabled flag in Entity ECA definition to disable the existing entity eca rule.
Add new attribute on entity eca tag named enabled
Default value will be true for this.
If user want to disable existing OOTB entity eca rule, then user can define same rule in custom component and set the enabled=false
Also as per current flow if same seca rule is define more then once, system will execute all the rule, ideally it should not execute same rule (same rule, condition and action) if its defined more than one.
Also need to ovride hasCode, equals and toString method for EntityEcaRule, EntityEcaAction and EntityEcaCondition class file.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1814160 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9839)
Use try with resources for SQL objects like ResultSet and other objects.
SQL classes have AutoCloseable interface.
Thanks: Pradhan Yash Sharma
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1812466 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9841)
Added AutoCloseable interface to SQLProcessor class and overridden Close method
Added closing of ResultSet, PreparedStatement and Connection Objects.
While calling SQLProcessor object in GenericDAO used Try-with-Resources and
removed unnecessary calls of the same object before actual use, also removed
finally blocks for method invocation.
Thanks: Pradhan Yash Sharma
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1812144 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9839)
Use try with resources for SQL objects like ResultSet and other objects.
SQL classes have AutoCloseable interface.
Thanks: Pradhan Yash Sharma
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1812104 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-5701)
Reverts
trunk r1804319
R16.11 r1804320
R15.12 r1804321
R14.12 r1804322
R13.07 r1804323
This raised 2 issues:
MSSQL as reported by Wei Zhang in OFBIZ-9676
Dynamic View Entities as reported by Pawan Verma in OFBIZ-5701
I asked kieuanhvu to see if he can provide a new patch taking these 2 issues in
consideration
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1810054 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9624)
When performing EntityQuery#getFieldList without specifying distinct a
NullPointerException is thrown, because of the condition if (this.distinct).
It implicitly calls this.distinct.booleanValue() which throws the exception if
distinct is null.
Thanks: Tobias Laufkötter
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1806220 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9441)
A major refactoring patch that applies the following changes:
- Fully refactor the EntityDataLoadContainer
- Fully refactor the TestRunContainer
- In both above mentioned containers the logic is broken up into smaller
methods to enhance code readability. It also changes the signature of
the method calls to rely on StartupCommand instead of String[] arrays
- Remove most old documentation and commented out code where applicable
- Delete the StratupCommandToArgsAdapter as it is no longer needed
- Create a new feature in which OFBiz by default fails if any data file
fails to load. This can be overridden by passing a flag called
"continue-on-failure" e.g. ./gradlew "ofbiz --load-data continue-on-failure"
- Add a new property to --test called "loglevel" (old code but working properly)
- Add many new properties to the --load-data command including repair-columns,
try-inserts, maintain-txs, etc ... These properties are old, but somehow
did not make it into the command line arguments. This code is now exposed
through the command line to set a direction in the future of whether to
keep or delete these extra commands
- Update the documentation output of ./gradlew "ofbiz --help" to incorporate
the new mentioned properties
- Refactor README.md to incorporate the changes to the gradle commands for both
"-load-data" and "-test" properties. Also remove the gradle GUI
documentation as it is now deprecated.
- Also refactor README.md in other locations to cleanup and make it more
consistent. This icludes moving long notes into new sections and reducing
the verbosity of the security header. Furthermore, created a new header
called Miscellaneous documentation to house the newly created sections
- lots of small changes to remove EOL white space
Thanks: Jacques Le Roux for reviewing and testing
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1805947 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9578)
In a recent github mirror, I've found suspicious code.
Branch: master
path: framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
...
1588 protected final List<String> messages = new LinkedList<String>();
...
1596 protected int updateData(Collection<String> messages) {
1597 if (messages != null && UtilValidate.isNotEmpty(this.messages)) {
1598 messages.addAll(messages);
1599 }
1600 return count;
1601 }
1602 }
In Line 1598, `messages.addAll' should be `this.messages.addAll'?
This might not be an issue but I wanted to report this just in case.
Thanks: JC (jaechang.nam@gmail.com)for report
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1805143 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9571)
No functional change.
We read at http://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html :
<<Using the integer fields in this class (such as ROUND_HALF_UP) to represent
rounding mode is largely obsolete; the enumeration values of the RoundingMode
enum, (such as RoundingMode.HALF_UP) should be used instead.>>
That's an easy global replacement. But it also needs to import the RoundingMode
class. It was 26 files so I decided to rather clean all the imports in all files
with the help of Eclipse.
This is a 1st step. I will need to closely look at 2 special class: UtilNumber
and Calculate.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1804953 13f79535-47bb-0310-9956-ffa450edef68
Add a DAO helper class to use a datasource as readonly
This helper is disable by default. To enable it change the helper class on your datasource use in entityengine.xml like
<datasource name="localderby"
helper-class="org.ofbiz.entity.datasource.ReadOnlyHelperDAO"
schema-name="OFBIZ" ...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1804826 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-5701)
jleroux: Kieuanhvu's explanation was not totally clear. So I rather provide
Renuka Srishti's at OFBIZ-9428 "getResultsSizeAfterPartialList() return wrong
count with distinct() for View Entity"
Here is the code sample to test the issue:
EntityListIterator productAssocListItr = null;
productAssocListItr = from("ProductAndAssoc").distinct().queryIterator();
productAssocListSize = productAssocListItr.getResultsSizeAfterPartialList();
productAssocListSize will differ from the actual distinct records in the
ProductAndAssoc View Entity.
This issue exists because it gives distinct records on the basis of the
first column in the table.
Thanks: Kieuanhvu for the patch, Renuka Srishti for a clear explanation and a
simple way to test (in a groovy for me)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1804319 13f79535-47bb-0310-9956-ffa450edef68
The warning message generated by OFBiz is a false positive caused by the fact that the way OFBiz performs the check is too simplistic: OFBiz parses for the content of the "()" in the fieldtype mapping and assumes that it is the column size.
However, in MySQL and possibly other database management systems, this is only true for varchar field definitions but not for datetime fields.
The column size for DATETIME(3) is not 3.
We should probably refactor the code in DatabaseUtil to compare the SQL field type from the JDBC driver, if possible to retrieve, (i.e. from the database) with the whole content (without any sting manipulation) of the attribute sql-type of the element field-type-def type (in fieldtype*.xml) i.e. "DATETIME(3)"; if they differ then a warning should be printed.
In this way we will have a more generic, simpler and more reliable tool to spot differences in the database
This is a workaround to fix the warning.
Thanks Jacopo.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1802693 13f79535-47bb-0310-9956-ffa450edef68
Like that :
GenericValue product = from('Product').where(context).queryOne()
This improvement simulate the minilang element <entity-one entity-name=Product value-name=product/> for helping the minilang migration to groovy
Thanks Jacopo to help the conception, Taher for the review
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1802660 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9305)
When print.verbose was set to true in debug.properties, the unit test
EntitySaxReaderTests.parse was failing because it is using some mock objects;
fixed by temporarily disabling the verbose logging during the test.
Thanks: William Wang for the report.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1799417 13f79535-47bb-0310-9956-ffa450edef68
As noted in code the EntityListIterator was not closed for a "good" reason: it
might be used later by the framework though not passed as a var. I think I found
1 case where it's closed after the returned list have been used (in
EntityAnd.getChildren() in ModelTree.java); but I have to check the whole thing
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1798086 13f79535-47bb-0310-9956-ffa450edef68
Improves EntityListIterator.close() warning
It was something like
ContentAssoc] has already been closed, not closing again.
It's now properly
This EntityListIterator for Entity [ContentAssoc] has already been closed,
not closing again.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1797356 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9385)
This is an improvement only because no cases were reported. But obviously in
case of unlucky exception after the EntityListIterator creation and before it's
closed the EntityListIterator remains in memory.
It should be closed in EntityListIterator.finalize() but the less happens there
the better.
The solution is to use try-with-ressources
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1797160 13f79535-47bb-0310-9956-ffa450edef68
with "id", "id-long" and "id-vlong" respectively which are primary keys
(OFBIZ-9354)
As discussed in http://markmail.org/message/d2tpovewhtotukwa the "not empty"
field types ("id-ne", "id-long-ne" and "id-vlong-ne") were initially added
to implement validations on data. But, because the validations where only
implemented in some place like webtools, it contradicts the distinction to be
upheld on various layers. So it is better to remove these field types.
So we will remove all those field types and will create sub tickets to replace
them in entity definitions by corresponding "id" types.
When replacing the "not empty" field types in entity definitions by
corresponding "id" types we will add a *not-null="true"* attribute to "makes
the field NOT NULL on the database (like primary key fields)" as explained in
"not-null" documentation in fieldtypemodel.xsd.
We will finally clean the documentation of the "not-null" in fieldtypemodel.xsd.
Deepak: If field is define as primary key field so by default is will be set as
not-null=true, so we can replace all the primary key field type from id-ne to id
in one shot.
Thanks: Deepak and Aditya
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1794743 13f79535-47bb-0310-9956-ffa450edef68