Author: jleroux
Date: Fri Apr 27 07:45:20 2012 New Revision: 1331272 URL: http://svn.apache.org/viewvc?rev=1331272&view=rev Log: Thanks to Amit Sharma who called me, this needs to be reverted: does not compile Modified: ofbiz/branches/release11.04/ (props changed) ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java Propchange: ofbiz/branches/release11.04/ ------------------------------------------------------------------------------ Reverse-merged /ofbiz/trunk:r1327735 Modified: ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java?rev=1331272&r1=1331271&r2=1331272&view=diff ============================================================================== --- ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java (original) +++ ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java Fri Apr 27 07:45:20 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.jdbc.JdbcValueHandler; @@ -415,31 +413,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; modelViewEntity.colNameString(modelViewEntity.getGroupBysCopy(), sql, " GROUP BY ", ", ", "", false); sql.append(")"); Modified: ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java?rev=1331272&r1=1331271&r2=1331272&view=diff ============================================================================== --- ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java (original) +++ ofbiz/branches/release11.04/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java Fri Apr 27 07:45:20 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); + } + } } @Deprecated @Override |
Free forum by Nabble | Edit this page |