You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2014/06/24 02:23:39 UTC

svn commit: r1604971 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: condition/EntityExpr.java test/EntityCryptoTestSuite.java

Author: doogie
Date: Tue Jun 24 00:23:38 2014
New Revision: 1604971

URL: http://svn.apache.org/r1604971
Log:
In EntityExpr.encryptConditionFields. pass the call down to the lhs and
rhs when we are in join mode.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java?rev=1604971&r1=1604970&r2=1604971&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java Tue Jun 24 00:23:38 2014
@@ -154,6 +154,11 @@ public class EntityExpr extends EntityCo
 
     @Override
     public void encryptConditionFields(ModelEntity modelEntity, Delegator delegator) {
+        if (operator.getClass().equals(EntityJoinOperator.class)) {
+            ((EntityCondition) lhs).encryptConditionFields(modelEntity, delegator);
+            ((EntityCondition) rhs).encryptConditionFields(modelEntity, delegator);
+            return;
+        }
         if (rhs instanceof EntityConditionValue) {
             return;
         }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java?rev=1604971&r1=1604970&r2=1604971&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java Tue Jun 24 00:23:38 2014
@@ -20,6 +20,8 @@ package org.ofbiz.entity.test;
 
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.entity.testtools.EntityTestCase;
 
 public class EntityCryptoTestSuite extends EntityTestCase {
@@ -86,14 +88,24 @@ public class EntityCryptoTestSuite exten
 
     public void testCryptoLookup() throws Exception {
         String nanoTime = "" + System.nanoTime();
+        EntityCondition condition;
 
         delegator.removeByAnd("TestingCrypto", UtilMisc.toMap("testingCryptoTypeId", "LOOKUP"));
         delegator.create("TestingCrypto", UtilMisc.toMap("testingCryptoId", "lookup-null", "testingCryptoTypeId", "LOOKUP"));
         delegator.create("TestingCrypto", UtilMisc.toMap("testingCryptoId", "lookup-value", "testingCryptoTypeId", "LOOKUP", "encryptedValue", nanoTime, "saltedEncryptedValue", nanoTime));
 
+        // This ends up using EntityExpr contained in EntityConditionList
         assertEquals(1, delegator.findByAnd("TestingCrypto", UtilMisc.toMap("testingCryptoTypeId", "LOOKUP", "encryptedValue", null), null, false).size());
         assertEquals(1, delegator.findByAnd("TestingCrypto", UtilMisc.toMap("testingCryptoTypeId", "LOOKUP", "saltedEncryptedValue", null), null, false).size());
         assertEquals(1, delegator.findByAnd("TestingCrypto", UtilMisc.toMap("testingCryptoTypeId", "LOOKUP", "encryptedValue", nanoTime), null, false).size());
         assertEquals(0, delegator.findByAnd("TestingCrypto", UtilMisc.toMap("testingCryptoTypeId", "LOOKUP", "saltedEncryptedValue", nanoTime), null, false).size());
+
+        // This ends up using EntityExpr contained in EntityExpr
+        condition = EntityCondition.makeCondition(
+            EntityCondition.makeCondition("testingCryptoTypeId", EntityOperator.EQUALS, "LOOKUP"),
+            EntityOperator.AND,
+            EntityCondition.makeCondition("encryptedValue", EntityOperator.EQUALS, nanoTime)
+        );
+        assertEquals(1, delegator.findList("TestingCrypto", condition, null, null, null, false).size());
     }
 }