svn commit: r1139921 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: jdbc/SqlJdbcUtil.java model/ModelViewEntity.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1139921 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: jdbc/SqlJdbcUtil.java model/ModelViewEntity.java

doogie-3
Author: doogie
Date: Sun Jun 26 19:19:00 2011
New Revision: 1139921

URL: http://svn.apache.org/viewvc?rev=1139921&view=rev
Log:
FEATURE: <view-conditon> on <view-link> is now supported.
This allows for LEFT JOINs that have additional filtering applied to
them.  FIXME: not implemented on theta- database types.

This feature depends on the following svn commits: 1139856, 1139869,
1139870, 1139879, 1139919.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java?rev=1139921&r1=1139920&r2=1139921&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java Sun Jun 26 19:19:00 2011
@@ -52,6 +52,7 @@ import org.ofbiz.entity.GenericEntityExc
 import org.ofbiz.entity.GenericModelException;
 import org.ofbiz.entity.GenericNotImplementedException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.condition.EntityConditionParam;
 import org.ofbiz.entity.condition.OrderByList;
 import org.ofbiz.entity.config.DatasourceInfo;
@@ -177,8 +178,14 @@ public class SqlJdbcUtil {
                         throw new GenericModelException("No view-link/join key-maps found for the " + viewLink.getEntityAlias() + " and the " + viewLink.getRelEntityAlias() + " member-entities of the " + modelViewEntity.getEntityName() + " view-entity.");
                     }
 
-                    // TODO add expression from entity-condition on view-link
-
+                    ModelViewEntity.ViewEntityCondition viewEntityCondition = viewLink.getViewEntityCondition();
+                    if (viewEntityCondition != null) {
+                        EntityCondition whereCondition = viewEntityCondition.getWhereCondition(modelFieldTypeReader, null);
+                        if (whereCondition != null) {
+                            condBuffer.append(" AND ");
+                            condBuffer.append(whereCondition.makeWhereString(modelEntity, null, datasourceInfo));
+                        }
+                    }
 
                     restOfStatement.append(condBuffer.toString());
 

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java?rev=1139921&r1=1139920&r2=1139921&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java Sun Jun 26 19:19:00 2011
@@ -1118,6 +1118,10 @@ public class ModelViewEntity extends Mod
             newList.addAll(this.keyMaps);
             return newList;
         }
+
+        public ViewEntityCondition getViewEntityCondition() {
+            return this.viewEntityCondition;
+        }
     }
 
     public final class ModelConversion implements Serializable {