You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2012/04/27 09:45:14 UTC
svn commit: r1331271 - in /ofbiz/branches/release10.04: ./
framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java
framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java
Author: jleroux
Date: Fri Apr 27 07:45:13 2012
New Revision: 1331271
URL: http://svn.apache.org/viewvc?rev=1331271&view=rev
Log:
Thanks to Amit Sharma who called me, this needs to be reverted: does not compile
Modified:
ofbiz/branches/release10.04/ (props changed)
ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java
ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java
Propchange: ofbiz/branches/release10.04/
------------------------------------------------------------------------------
Reverse-merged /ofbiz/trunk:r1327735
Modified: ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java?rev=1331271&r1=1331270&r2=1331271&view=diff
==============================================================================
--- ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java (original)
+++ ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java Fri Apr 27 07:45:13 2012
@@ -40,7 +40,6 @@ import java.util.TreeSet;
import javax.sql.rowset.serial.SerialBlob;
import javax.sql.rowset.serial.SerialClob;
-import javolution.util.FastList;
import javolution.util.FastMap;
import org.ofbiz.base.util.Debug;
@@ -54,7 +53,6 @@ import org.ofbiz.entity.GenericModelExce
import org.ofbiz.entity.GenericNotImplementedException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.condition.EntityConditionParam;
-import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.condition.OrderByList;
import org.ofbiz.entity.config.DatasourceInfo;
import org.ofbiz.entity.model.ModelEntity;
@@ -406,31 +404,11 @@ public class SqlJdbcUtil {
}
sql.append(makeFromClause(modelEntity, datasourceInfo));
String viewWhereClause = makeViewWhereClause(modelEntity, datasourceInfo.joinStyle);
- ModelViewEntity modelViewEntity = (ModelViewEntity)modelEntity;
- List<EntityCondition> whereConditions = FastList.newInstance();
- List<EntityCondition> havingConditions = FastList.newInstance();
- List<String> orderByList = FastList.newInstance();
-
- modelViewEntity.populateViewEntityConditionInformation(modelFieldTypeReader, whereConditions, havingConditions, orderByList, null);
- String viewConditionClause;
- if (!whereConditions.isEmpty()) {
- viewConditionClause = EntityCondition.makeCondition(whereConditions, EntityOperator.AND).makeWhereString(modelViewEntity, null, datasourceInfo);
- } else {
- viewConditionClause = null;
- }
- if (UtilValidate.isNotEmpty(viewWhereClause) || UtilValidate.isNotEmpty(viewConditionClause)) {
+ if (UtilValidate.isNotEmpty(viewWhereClause)) {
sql.append(" WHERE ");
- if (UtilValidate.isNotEmpty(viewWhereClause)) {
- sql.append("(").append(viewWhereClause).append(")");
- if (UtilValidate.isNotEmpty(viewConditionClause)) {
- sql.append(" AND ");
- }
- }
- if (UtilValidate.isNotEmpty(viewConditionClause)) {
- sql.append("(").append(viewConditionClause).append(")");
- }
+ sql.append(viewWhereClause);
}
- // FIXME: handling HAVING, don't need ORDER BY for nested views
+ ModelViewEntity modelViewEntity = (ModelViewEntity)modelEntity;
String groupByString = modelViewEntity.colNameString(modelViewEntity.getGroupBysCopy(), ", ", "", false);
if (UtilValidate.isNotEmpty(groupByString)) {
sql.append(" GROUP BY ");
Modified: ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java?rev=1331271&r1=1331270&r2=1331271&view=diff
==============================================================================
--- ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java (original)
+++ ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java Fri Apr 27 07:45:13 2012
@@ -315,6 +315,16 @@ public class ModelViewEntity extends Mod
orderByList.addAll(currentOrderByList);
}
}
+
+ for (Map.Entry<String, String> memberEntityEntry: this.memberModelEntities.entrySet()) {
+ ModelEntity modelEntity = this.getModelReader().getModelEntityNoCheck(memberEntityEntry.getValue());
+ if (modelEntity instanceof ModelViewEntity) {
+ ModelViewEntity memberViewEntity = (ModelViewEntity) modelEntity;
+ entityAliasStack.add(memberEntityEntry.getKey());
+ memberViewEntity.populateViewEntityConditionInformation(modelFieldTypeReader, whereConditions, havingConditions, orderByList, entityAliasStack);
+ entityAliasStack.remove(entityAliasStack.size() - 1);
+ }
+ }
}
@Override