Commit Graph
1030 Commits
Author SHA1 Message Date
Adam Heath 8ea51fb77e Fix issues with inventory creation/transfer tests, and with the entity
engine tests, when run with java1.7.  Apparently, the order of methods
returned by reflection varies between runs, so if methods have implicit
requirements on each other, you get spurious errors.

The are 3 types of fixes:

* Combine the separate testCase methods into one
* Add explict method ordering.
* Make use testCase method completely stand-alone.

The product inventory tests were combined, while the entity engine tests
were restructured to be stand-alone.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1605269 13f79535-47bb-0310-9956-ffa450edef68
2014-06-25 05:27:30 +00:00
Adam Heath 1596c224f4 Re-enable hiding of condition parameters in toString calls; this was
accidentally checked in as part of r1604972.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604985 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:45:28 +00:00
Adam Heath c423838342 Remove encryptConditionFields from the condition objects; now, the
encryption/decryption happens at the jdbc layer, when values are set
into a PreparedStatement, or fetched from a ResultSet.

This means that conditions are no longer munged to contain the encrypted
value, and entities are no longer updated to temporarily contain the
encrypted value.  In all cases, the value of a field in memory will be
unecncrypted.

This fixes the following code patterns:

person = delegator.create("Person", [partyId: "my-party"]);
person.socialSecurityNumber = "1234";
person.store();
// this fails, the encrypted value is stored inside entity
assertEquals("1234", person.socialSecurityNumber);
currentValue = person.socialSecurityNumber
person.store();
// this fails, the field is doubly-encrypted
assertEquals(currentValue, person.socialSecurityNumber);

origCondition = EntityCondition.makeCondition(
    "socialSecurityNumber",
    EntityOperator.EQUALS,
    "1234"
);
list = delegator.findList("Person", origCondition);
newCondition = EntityCondition.makeCondition(
    "socialSecurityNumber",
    EntityOperator.EQUALS,
    "1234"
);
// this fails, because the condition is updated in-place, with the
// encrypted field value.
assertEquals(origCondition, newCondition);

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604976 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:24:22 +00:00
Adam Heath eeb2cc31f3 Condition objects are now immutable. This removed more uses of
javolution classes, namely, all the factory support code is now gone.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604975 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:24:08 +00:00
Adam Heath e226c3310b Restructured so that the built-up object is a wrapper around the actual
condition; this allows the wrapped value to be changed, as the builder
api is used, and will make it possible for the actual condition object
to be made final.

To allow for this wrapper to be passed to the delegator, it extends
EntityCondition, and delegates all calls to the contained condition
object.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604974 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:24:01 +00:00
Adam Heath fb157fd4c7 encryptConditionFields now returns a new EntityCondition, if it did
anything.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604973 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:23:54 +00:00
Adam Heath 40a06ca876 Add EntityConditionValue.encryptConditionFields support to
EntityConditionValue.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604972 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:23:46 +00:00
Adam Heath b6662d97b3 In EntityExpr.encryptConditionFields. pass the call down to the lhs and
rhs when we are in join mode.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604971 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:23:38 +00:00
Adam Heath 9d5779c95b This is the first phase at making EntityCondition objects immutable; the
classes/fields not yet finalized are left undone due to there being
side-effects with other parts of the code base.  These side-effects will
be fixed shortly.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604969 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:23:32 +00:00
Adam Heath 5bc5c4151f Change encrypt=true fields to no longer have a pre-pended salt value.
This is done by just setting the length of salt bytes to 0, but still
having a length byte prepended.

Add a feature to allow for certain fields to actually have a salt
prefix.  This is enabled by setting encrypt=salt in the entity
definition.

This change is slightly incompatible with existing code.  Old database
values will continue to be decrypted correctly.  However, newly
encrypted values will no longer have a salt prepended, while originally
they would.  This shouldn't be a problem in practice.

This change, along with the previous commit, finally allow for direct
lookup of encrypted values.  However, already stored values will not be
found.  To fix those, each database row will have to be read in by
ofbiz, then immediately written back out.

This is part two to completely fix OFBIZ-5959:
Person.socialSecurityNumber can't be used for findByAnd.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604968 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:23:23 +00:00
Adam Heath 91b11ac4f8 Fix EntityExpr encryptConditionFields; in normal use, lhs would never be
a String, because it would end up being wrapped in an EntityFieldValue
object.  The only way it would be a String is during incorrect
Freemarker lookups(which no longer happen, as the
EntityCondition.makeCondition factory pattern is now in use).

With this fix in place, EntityExpr can finally start encrypting it's
field values, so that direct matching on encrypted fields can work.

This is part one to fix OFBIZ-5959: Person.socialSecurityNumber can't be
used for findByAnd.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604967 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:23:11 +00:00
Adam Heath 0aaad002d6 Start creating test cases for the entity engine crypto feature.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604966 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:23:04 +00:00
Adam Heath cf7cfdc544 Remove the last uses of FastList from the entity engine.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604038 13f79535-47bb-0310-9956-ffa450edef68
2014-06-19 21:38:48 +00:00
Jacques Le Roux d7782d5fb9 Completes OFBIZ-5648 - Extend primary keys, removes trailing blanks
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1597273 13f79535-47bb-0310-9956-ffa450edef68
2014-05-24 09:51:48 +00:00
Jacques Le Roux 79365e65da Completes OFBIZ-5648 - Extend primary keys, by adding XSD documentation about current restrictions
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1597270 13f79535-47bb-0310-9956-ffa450edef68
2014-05-24 09:14:22 +00:00
Jacques Le Roux a00123d7e7 Closes OFBIZ-5648 - Extend primary keys
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1597239 13f79535-47bb-0310-9956-ffa450edef68
2014-05-24 05:09:39 +00:00
Jacopo Cappellato 1ea8fe79b2 Fixes for a bug reported by Pierre Smits in OFBIZ-4130 (and OFBIZ-5319): a tenant user can access, via the delegator, the meta data information of other tenants; for example a tenant user with grants to use the Webtools application could view/edit the database details of all tenants.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1589589 13f79535-47bb-0310-9956-ffa450edef68
2014-04-24 05:19:13 +00:00
Adrian Crum c63f91c75b GenericEntity.java bug fix, updated the unit tests.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1575589 13f79535-47bb-0310-9956-ffa450edef68
2014-03-08 18:48:35 +00:00
Adrian Crum d79ac2631a Upgrade Derby to 10.10.1.1.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1553893 13f79535-47bb-0310-9956-ffa450edef68
2013-12-28 19:20:08 +00:00
Adrian Crum 7cad5f6af5 A small code cleanup in the entity engine - remove deprecated functionality. Originally, the "blob" field type was used as a catch-all for java.sql.Blob, byte[], and java.lang.Object. Now each Java type has its own field type - so you must specify the correct one.
IMPORTANT: This commit might break some applications. If you get ClassCastExceptions, then you need to change the field type in your entity from blob to either byte-array or object. The change will have no effect on your database - because they are all persisted as BLOB SQL types.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1553890 13f79535-47bb-0310-9956-ffa450edef68
2013-12-28 19:15:58 +00:00
Jacques Le Roux 1276dc8eb8 Removes an useless debug log error, caught around anyway
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1552311 13f79535-47bb-0310-9956-ffa450edef68
2013-12-19 13:17:03 +00:00
Jacques Le Roux c75405ca4a Even if I don't like much never-ending stacks in logs, this adds a log error in case the exception would be swallowed (recommended practice)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1552249 13f79535-47bb-0310-9956-ffa450edef68
2013-12-19 08:08:16 +00:00
Jacques Le Roux 748770fb6d No functional change. As suggested Adrian on dev ML, creates the AtomicReference update outside the try-catch block.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1552120 13f79535-47bb-0310-9956-ffa450edef68
2013-12-18 21:56:33 +00:00
Jacques Le Roux be880e2c5f No functional automated changes
Add @Override annotations
Fixes comments indentation
Removes trailing blanks


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1552077 13f79535-47bb-0310-9956-ffa450edef68
2013-12-18 20:12:37 +00:00
Jacques Le Roux 60597ea005 Fixes <<FIXME: Replace DCL code with AtomicReference>>
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1552073 13f79535-47bb-0310-9956-ffa450edef68
2013-12-18 19:46:50 +00:00
Jacques Le Roux 3d458932c5 A slightly modified patch from Leon for "sequence-bank-size attributes does not work anymore" https://issues.apache.org/jira/browse/OFBIZ-5429
No matter how I set "sequence-bank-size" for an entity (in my example, its "EntityAuditLog"), the bank size is always default value "10".
It seems that this feature was lost by a serials update of revision 922724 to 922733 submitted by doogie.

jleroux: This thread http://markmail.org/message/ifosqek74gqtv7fz trace the root cause
Leon's fix is safe from a concurrency perspective. I just added a check on SequenceBank.maxBankSize and put some doc in the XSD

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1551744 13f79535-47bb-0310-9956-ffa450edef68
2013-12-17 22:45:20 +00:00
Adrian Crum fb23ff7e09 Improved error message in GenericEntity.java - no functional change. The improved message should help developers solve the problem causing the exception.
This has been discussed before, but I will mention it again for instruction: GenericEntity instances that are kept in the entity cache are shared among multiple threads. Therefore, they must be immutable. If you get a GenericEntity instance from the cache and you want to modify it, you must clone it first.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1547790 13f79535-47bb-0310-9956-ffa450edef68
2013-12-04 12:43:24 +00:00
Adrian Crum 3afb5a5c06 Fixed a regression in ModelEntity.java caused by the recent thread-safety refactoring. Patch provided by Leon - https://issues.apache.org/jira/browse/OFBIZ-5399.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1543994 13f79535-47bb-0310-9956-ffa450edef68
2013-11-21 00:37:08 +00:00
Jacques Le Roux a38a21fc0a This closes "Introduce Tomcat's JreMemoryLeakPreventionListener and why" https://issues.apache.org/jira/browse/OFBIZ-5395
The idea is to avoid ThreadLocal with custom classes, this can lead to memory leaks when an external application server is used.
Reverts r1075322 (commit for OFBIZ-4107) hence removes CompilerMatcher 
Uses PatternFactory instead of CompilerMatcher class (from CompilerMatcher keeps the compiled patterns cache idea)
In UtilHttp.java
  Removes dead code
  Removes useless "UtilHttp." for class methods and constants calls (moot point, have we conventions on this?).


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1542960 13f79535-47bb-0310-9956-ffa450edef68
2013-11-18 09:46:35 +00:00
Hans Bakker 0b22680991 some errors left from the removal of the postgresqlnew data resource
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1537396 13f79535-47bb-0310-9956-ffa450edef68
2013-10-31 07:45:36 +00:00
Adrian Crum a2c1465efd Fixed a bug in the entity tests - JUnit expected and actual arguments were reversed in the testTransactionUtilRollback test.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1533542 13f79535-47bb-0310-9956-ffa450edef68
2013-10-18 16:34:09 +00:00
Adrian Crum 4b75f74431 Fixed some flaws in the JDBC password handling code. Improved JavaDocs in updated code.
The original code would provide a null or empty password (depending on code branching) if no password was configured, so I wasn't able to determine what the desired behavior was. Now an exception is thrown if there is no JDBC password, and datasource connection attempts fail gracefully.

If we want to support 'authenticationless' JDBC connections, then this will need to be looked at again.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1533202 13f79535-47bb-0310-9956-ffa450edef68
2013-10-17 18:33:49 +00:00
Adrian Crum 047036654c Added some convenience methods to GenericHelperInfo.java that will help simplify client code.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1533171 13f79535-47bb-0310-9956-ffa450edef68
2013-10-17 17:27:51 +00:00
Adrian Crum 4dd795cb50 Code cleanup and small optimization in GenericHelperInfo.java.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1533147 13f79535-47bb-0310-9956-ffa450edef68
2013-10-17 16:42:42 +00:00
Jacques Le Roux 0381244267 This completes r1530237 where fieldtypepostnew.xml has been removed.
* Removes useless commented out blocks of <group-maps in <delegators definitions
* Removes now useless localpostnew <datasource definition
* Default the result-fetch-size attribute to 50, and comment about older unsupported versions of jdbc drivers

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1531269 13f79535-47bb-0310-9956-ffa450edef68
2013-10-11 12:21:51 +00:00
Adrian Crum 771000f8f0 Allow redefinition of view entities. XML schema change only - implementation exists already.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1530976 13f79535-47bb-0310-9956-ffa450edef68
2013-10-10 13:41:45 +00:00
Jacques Le Roux c8ce55ecc9 A patch from Anahita Goljahani for Fixed mispelling of "occurred" https://issues.apache.org/jira/browse/OFBIZ-5342
jleroux: this includes a safe change in jquery.validate.js and jquery.validate.min.js

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1530341 13f79535-47bb-0310-9956-ffa450edef68
2013-10-08 16:35:40 +00:00
Jacques Le Roux e5791f84bf SAP changes for CC date type was missing at r1530235
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1530238 13f79535-47bb-0310-9956-ffa450edef68
2013-10-08 11:40:22 +00:00
Jacques Le Roux d7de823054 As suggested on dev ML: merges fieldtypepostgres.xml and fieldtypepostnew.xml and finally removes fieldtypepostnew.xml
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1530237 13f79535-47bb-0310-9956-ffa450edef68
2013-10-08 11:39:08 +00:00
Jacques Le Roux 8fcd9e7ad7 Fix a bug reported by Anahita Goljahani on dev ML
At r1529674 I forgot that CC numbers are encoded in DB and CC dates are not 4 (1013) but 7 chars (10/2013)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1530235 13f79535-47bb-0310-9956-ffa450edef68
2013-10-08 11:36:07 +00:00
Adrian Crum 0a48201604 There is some confusion over maximum email address length due to conflicting RFCs. So, we will accept the longest length specified and let the email servers decide what they will accept.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1529838 13f79535-47bb-0310-9956-ffa450edef68
2013-10-07 13:31:55 +00:00
Jacques Le Roux 3ca4b45d8f Same restriction for email addresses than recently done for url. An email address is now definitively no more than 254 characters:
https://en.wikipedia.org/wiki/Email_address#Syntax
http://stackoverflow.com/questions/386294/what-is-the-maximum-length-of-a-valid-email-address#answer-574698
Also a CC number and date are respectively no more than 19 and 4 digits: https://en.wikipedia.org/wiki/ISO/IEC_7813

I decided to not limit the tel numbers (now 60 chars seems plenty enough), maybe someone will even needs to increase in a far future :)

While at it, normalises fieldtypepostnew.xml:
* Removes confusing comment in header
* Restricts most types like in fieldtypepostgres.xml (no needs to have them longer), but keep unlimited (actually 2GB max): comment, description


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1529674 13f79535-47bb-0310-9956-ffa450edef68
2013-10-06 20:03:12 +00:00
Adrian Crum 684d49d8b1 Updated the Hypersonic SQL support in the entity engine.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1529644 13f79535-47bb-0310-9956-ffa450edef68
2013-10-06 16:35:50 +00:00
Adrian Crum a04a0a2746 Increased the "url" field type to 2000 characters.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1529637 13f79535-47bb-0310-9956-ffa450edef68
2013-10-06 15:57:31 +00:00
Adrian Crum 91294728c2 Fixed a problem with bad try-catch-finally nesting and transaction handling in GenericDelegator.
1. The only exception caught was GenericEntityException, so any other thrown exception was missed - meaning the transaction was committed and GenericDelegator acted as if nothing was wrong.

2. The commit was performed in the finally block, so it was ALWAYS performed - even after an exception was thrown and the transaction was rolled back.

We managed to get away with this all along because typically there is a wrapping transaction that clears it all up. But still, the Delegator code needs to handle transactions correctly.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1527810 13f79535-47bb-0310-9956-ffa450edef68
2013-09-30 22:43:02 +00:00
Adrian Crum d64e8c0c7c Fixed a subtle flaw in the GenericDelegator.findOne method. When a database query returns no result, GenericValue.NULL_VALUE is put in the pk cache - so future findOne calls will know the entity value doesn't exist. But the findOne method never checked for GenericValue.NULL_VALUE in cache gets, so the database was queried again for an entity value we already know doesn't exist.
https://issues.apache.org/jira/browse/OFBIZ-5332


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1527626 13f79535-47bb-0310-9956-ffa450edef68
2013-09-30 16:13:03 +00:00
Adrian Crum 8117cb5756 Small change to GenericDelegator.findOne method - moved the primary key validation check to the beginning of the method.
I believe the original intention was to perform the validation check after the EV_VALIDATE ECAs were run, but the primary key was being used in three method calls before that happened - so those methods could have been passed an invalid primary key.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1527609 13f79535-47bb-0310-9956-ffa450edef68
2013-09-30 15:15:35 +00:00
Adrian Crum d5511e39cd Small code cleanup and optimization in ModelEntityChecker.java.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1526226 13f79535-47bb-0310-9956-ffa450edef68
2013-09-25 16:44:16 +00:00
Jacques Le Roux ff5f0a5096 A patch for "Deprecate doCacheClear in Delegator interface and class and related minilang classes" https://issues.apache.org/jira/browse/OFBIZ-5325
* Deprecates methods in Delegator interface and class
* Deprecates cache clear related variable and methods in EntitySaxReader class
* Deprecates cache clear related variables in minilang related delegator classes
* In simple-method schema annotations, marks do-cache-clear attribute as deprecated 


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1524704 13f79535-47bb-0310-9956-ffa450edef68
2013-09-19 12:03:47 +00:00
Adrian Crum 572ac66d16 Minor change to GenericDelegator - Put some logging calls inside if blocks.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1524183 13f79535-47bb-0310-9956-ffa450edef68
2013-09-17 19:17:49 +00:00