You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Hans Bakker <ma...@antwebsystems.com> on 2009/07/03 06:20:40 UTC

David,

this commit breaks the myportal component. Although only three portlets
should be shown on the main portal page for the user admin, it now shows
all portlets irrespective of the portal page selected.

in PortalPageScreens.xml:

<entity-and entity-name="PortalPagePortletView"
                                    list="portalPagePortlets">
    <field-map field-name="portalPageId"
                               from-field="portalPage.portalPageId"/>
    <order-by field-name="columnSeqId"/>
    <order-by field-name="sequenceNum"/>
</entity-and>

it looks like the fieldmap is not taken into account anymore

r790455 works fine, r790472 has the problem.

Regards,
Hans



On Thu, 2009-07-02 at 06:43 +0000, jonesde@apache.org wrote:
> Author: jonesde
> Date: Thu Jul  2 06:43:50 2009
> New Revision: 790472
> 
> URL: http://svn.apache.org/viewvc?rev=790472&view=rev
> Log:
> Added ability to specify an entity-condition as part of a view-entity in order to encapsulate a full query definition in a view-entity
> 
> Modified:
>     ofbiz/trunk/framework/entity/dtd/entitymodel.xsd
>     ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
>     ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
>     ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByConditionFinder.java
>     ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java
>     ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/Finder.java
>     ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java
>     ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java
>     ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java
>     ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java
>     ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
> 
> Modified: ofbiz/trunk/framework/entity/dtd/entitymodel.xsd
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/dtd/entitymodel.xsd?rev=790472&r1=790471&r2=790472&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/entity/dtd/entitymodel.xsd (original)
> +++ ofbiz/trunk/framework/entity/dtd/entitymodel.xsd Thu Jul  2 06:43:50 2009
> @@ -60,12 +60,12 @@
>      </xs:element>
>      <!-- see the children of entitymodel section for description, etc. -->
>      <xs:attributeGroup name="attlist.entity">
> -        <xs:attribute type="xs:string" name="entity-name" use="required"/>
> -        <xs:attribute type="xs:string" name="table-name"/>
> -        <xs:attribute type="xs:string" name="package-name" use="required"/>
> -        <xs:attribute type="xs:string" name="default-resource-name"/>
> -        <xs:attribute type="xs:string" name="dependent-on"/>
> -        <xs:attribute type="xs:string" name="sequence-bank-size"/>
> +        <xs:attribute name="entity-name" type="xs:string" use="required"/>
> +        <xs:attribute name="table-name" type="xs:string"/>
> +        <xs:attribute name="package-name" type="xs:string" use="required"/>
> +        <xs:attribute name="default-resource-name" type="xs:string"/>
> +        <xs:attribute name="dependent-on" type="xs:string"/>
> +        <xs:attribute name="sequence-bank-size" type="xs:string"/>
>          <xs:attribute name="enable-lock" default="false">
>              <xs:simpleType>
>                  <xs:restriction base="xs:token">
> @@ -98,10 +98,10 @@
>                  </xs:restriction>
>              </xs:simpleType>
>          </xs:attribute>
> -        <xs:attribute type="xs:string" name="title"/>
> -        <xs:attribute type="xs:string" name="copyright"/>
> -        <xs:attribute type="xs:string" name="author"/>
> -        <xs:attribute type="xs:string" name="version"/>
> +        <xs:attribute name="title" type="xs:string"/>
> +        <xs:attribute name="copyright" type="xs:string"/>
> +        <xs:attribute name="author" type="xs:string"/>
> +        <xs:attribute name="version" type="xs:string"/>
>      </xs:attributeGroup>
>      <xs:element name="prim-key">
>          <xs:complexType>
> @@ -109,7 +109,7 @@
>          </xs:complexType>
>      </xs:element>
>      <xs:attributeGroup name="attlist.prim-key">
> -        <xs:attribute type="xs:string" name="field" use="required"/>
> +        <xs:attribute name="field" type="xs:string" use="required"/>
>      </xs:attributeGroup>
>      <!-- ==================== field ===================== -->
>      <xs:element name="field">
> @@ -122,9 +122,9 @@
>          </xs:complexType>
>      </xs:element>
>      <xs:attributeGroup name="attlist.field">
> -        <xs:attribute type="xs:string" name="name" use="required"/>
> -        <xs:attribute type="xs:string" name="col-name"/>
> -        <xs:attribute type="xs:string" name="type" use="required"/>
> +        <xs:attribute name="name" type="xs:string" use="required"/>
> +        <xs:attribute name="col-name" type="xs:string"/>
> +        <xs:attribute name="type" type="xs:string" use="required"/>
>          <xs:attribute name="encrypt" default="false">
>              <xs:simpleType>
>                  <xs:restriction base="xs:token">
> @@ -171,7 +171,7 @@
>          </xs:complexType>
>      </xs:element>
>      <xs:attributeGroup name="attlist.validate">
> -        <xs:attribute type="xs:string" name="name" use="required"/>
> +        <xs:attribute name="name" type="xs:string" use="required"/>
>      </xs:attributeGroup>
>      <!-- ==================== relation ====================== -->
>      <!-- specifies whether or not the relation is a dependent one; ie if the related entity can exist without the main entity -->
> @@ -194,9 +194,9 @@
>                  </xs:restriction>
>              </xs:simpleType>
>          </xs:attribute>
> -        <xs:attribute type="xs:string" name="title"/>
> -        <xs:attribute type="xs:string" name="rel-entity-name" use="required"/>
> -        <xs:attribute type="xs:string" name="fk-name"/>
> +        <xs:attribute name="title" type="xs:string"/>
> +        <xs:attribute name="rel-entity-name" type="xs:string" use="required"/>
> +        <xs:attribute name="fk-name" type="xs:string"/>
>      </xs:attributeGroup>
>      <xs:element name="key-map">
>          <xs:complexType>
> @@ -204,8 +204,8 @@
>          </xs:complexType>
>      </xs:element>
>      <xs:attributeGroup name="attlist.key-map">
> -        <xs:attribute type="xs:string" name="field-name" use="required"/>
> -        <xs:attribute type="xs:string" name="rel-field-name"/>
> +        <xs:attribute name="field-name" type="xs:string" use="required"/>
> +        <xs:attribute name="rel-field-name" type="xs:string"/>
>      </xs:attributeGroup>
>      <!-- ==================== index ===================== -->
>      <xs:element name="index">
> @@ -218,7 +218,7 @@
>          </xs:complexType>
>      </xs:element>
>      <xs:attributeGroup name="attlist.index">
> -        <xs:attribute type="xs:string" name="name" use="required"/>
> +        <xs:attribute name="name" type="xs:string" use="required"/>
>          <xs:attribute name="unique" default="false">
>              <xs:simpleType>
>                  <xs:restriction base="xs:token">
> @@ -234,8 +234,9 @@
>          </xs:complexType>
>      </xs:element>
>      <xs:attributeGroup name="attlist.index-field">
> -        <xs:attribute type="xs:string" name="name" use="required"/>
> +        <xs:attribute name="name" type="xs:string" use="required"/>
>      </xs:attributeGroup>
> +    
>      <!-- ================== view-entity ===================== -->
>      <xs:element name="view-entity">
>          <xs:complexType>
> @@ -246,16 +247,17 @@
>                  <xs:element minOccurs="0" maxOccurs="unbounded" ref="alias"/>
>                  <xs:element minOccurs="0" maxOccurs="unbounded" ref="view-link"/>
>                  <xs:element minOccurs="0" maxOccurs="unbounded" ref="relation"/>
> +                <xs:element minOccurs="0" ref="entity-condition"/>
>              </xs:sequence>
>              <xs:attributeGroup ref="attlist.view-entity"/>
>          </xs:complexType>
>      </xs:element>
>      <!-- see the children of entitymodel section for description, etc. -->
>      <xs:attributeGroup name="attlist.view-entity">
> -        <xs:attribute type="xs:string" name="entity-name" use="required"/>
> -        <xs:attribute type="xs:string" name="package-name" use="required"/>
> -        <xs:attribute type="xs:string" name="dependent-on"/>
> -        <xs:attribute type="xs:string" name="default-resource-name"/>
> +        <xs:attribute name="entity-name" type="xs:string" use="required"/>
> +        <xs:attribute name="package-name" type="xs:string" use="required"/>
> +        <xs:attribute name="dependent-on" type="xs:string"/>
> +        <xs:attribute name="default-resource-name" type="xs:string"/>
>          <xs:attribute name="never-cache" default="false">
>              <xs:simpleType>
>                  <xs:restriction base="xs:token">
> @@ -272,10 +274,10 @@
>                  </xs:restriction>
>              </xs:simpleType>
>          </xs:attribute>
> -        <xs:attribute type="xs:string" name="title"/>
> -        <xs:attribute type="xs:string" name="copyright"/>
> -        <xs:attribute type="xs:string" name="author"/>
> -        <xs:attribute type="xs:string" name="version"/>
> +        <xs:attribute name="title" type="xs:string"/>
> +        <xs:attribute name="copyright" type="xs:string"/>
> +        <xs:attribute name="author" type="xs:string"/>
> +        <xs:attribute name="version" type="xs:string"/>
>      </xs:attributeGroup>
>      <xs:element name="member-entity">
>          <xs:complexType>
> @@ -286,8 +288,8 @@
>          </xs:complexType>
>      </xs:element>
>      <xs:attributeGroup name="attlist.member-entity">
> -        <xs:attribute type="xs:string" name="entity-alias" use="required"/>
> -        <xs:attribute type="xs:string" name="entity-name" use="required"/>
> +        <xs:attribute name="entity-alias" type="xs:string" use="required"/>
> +        <xs:attribute name="entity-name" type="xs:string" use="required"/>
>      </xs:attributeGroup>
>      <xs:element name="alias-all">
>          <xs:complexType>
> @@ -299,8 +301,8 @@
>          </xs:complexType>
>      </xs:element>
>      <xs:attributeGroup name="attlist.alias-all">
> -        <xs:attribute type="xs:string" name="entity-alias" use="required"/>
> -        <xs:attribute type="xs:string" name="prefix"/>
> +        <xs:attribute name="entity-alias" type="xs:string" use="required"/>
> +        <xs:attribute name="prefix" type="xs:string"/>
>          <xs:attribute name="group-by" default="false">
>              <xs:simpleType>
>                  <xs:restriction base="xs:token">
> @@ -330,7 +332,7 @@
>          </xs:complexType>
>      </xs:element>
>      <xs:attributeGroup name="attlist.exclude">
> -        <xs:attribute type="xs:string" name="field" use="required"/>
> +        <xs:attribute name="field" type="xs:string" use="required"/>
>      </xs:attributeGroup>
>      <xs:element name="alias">
>          <xs:complexType>
> @@ -342,11 +344,11 @@
>          </xs:complexType>
>      </xs:element>
>      <xs:attributeGroup name="attlist.alias">
> -        <xs:attribute type="xs:string" name="entity-alias"/>
> -        <xs:attribute type="xs:string" name="name" use="required"/>
> -        <xs:attribute type="xs:string" name="field"/>
> -        <xs:attribute type="xs:string" name="col-alias"/>
> -        <xs:attribute type="xs:string" name="prim-key"/>
> +        <xs:attribute name="entity-alias" type="xs:string"/>
> +        <xs:attribute name="name" type="xs:string" use="required"/>
> +        <xs:attribute name="field" type="xs:string"/>
> +        <xs:attribute name="col-alias" type="xs:string"/>
> +        <xs:attribute name="prim-key" type="xs:string"/>
>          <xs:attribute name="group-by" default="false">
>              <xs:simpleType>
>                  <xs:restriction base="xs:token">
> @@ -393,7 +395,7 @@
>          </xs:complexType>
>      </xs:element>
>      <xs:attributeGroup name="attlist.complex-alias">
> -        <xs:attribute type="xs:string" name="operator" use="required"/>
> +        <xs:attribute name="operator" type="xs:string" use="required"/>
>      </xs:attributeGroup>
>      <xs:element name="complex-alias-field">
>          <xs:complexType>
> @@ -401,9 +403,9 @@
>          </xs:complexType>
>      </xs:element>
>      <xs:attributeGroup name="attlist.complex-alias-field">
> -        <xs:attribute type="xs:string" name="entity-alias" use="required"/>
> -        <xs:attribute type="xs:string" name="field" use="required"/>
> -        <xs:attribute type="xs:string" name="default-value"/>
> +        <xs:attribute name="entity-alias" type="xs:string" use="required"/>
> +        <xs:attribute name="field" type="xs:string" use="required"/>
> +        <xs:attribute name="default-value" type="xs:string"/>
>          <xs:attribute name="function">
>              <xs:simpleType>
>                  <xs:restriction base="xs:token">
> @@ -429,8 +431,8 @@
>          </xs:complexType>
>      </xs:element>
>      <xs:attributeGroup name="attlist.view-link">
> -        <xs:attribute type="xs:string" name="entity-alias" use="required"/>
> -        <xs:attribute type="xs:string" name="rel-entity-alias" use="required"/>
> +        <xs:attribute name="entity-alias" type="xs:string" use="required"/>
> +        <xs:attribute name="rel-entity-alias" type="xs:string" use="required"/>
>          <xs:attribute name="rel-optional" default="false">
>              <xs:simpleType>
>                  <xs:restriction base="xs:token">
> @@ -440,7 +442,155 @@
>              </xs:simpleType>
>          </xs:attribute>
>      </xs:attributeGroup>
> +    <xs:element name="entity-condition">
> +        <xs:complexType>
> +            <xs:sequence>
> +                <xs:choice minOccurs="0">
> +                    <xs:element ref="condition-expr"/>
> +                    <xs:element ref="condition-list"/>
> +                    <xs:element ref="condition-object"/>
> +                </xs:choice>
> +                <xs:element minOccurs="0" ref="having-condition-list"/>
> +                <xs:element minOccurs="0" maxOccurs="unbounded" ref="order-by"/>
> +            </xs:sequence>
> +            <xs:attributeGroup ref="attlist.entity-condition"/>
> +        </xs:complexType>
> +    </xs:element>
> +    <xs:attributeGroup name="attlist.entity-condition">
> +        <xs:attribute name="filter-by-date" default="false">
> +            <xs:simpleType>
> +                <xs:restriction base="xs:token">
> +                    <xs:enumeration value="true"/>
> +                    <xs:enumeration value="false"/>
> +                    <xs:enumeration value="by-name"/>
> +                </xs:restriction>
> +            </xs:simpleType>
> +        </xs:attribute>
> +        <xs:attribute name="distinct" default="false">
> +            <xs:simpleType>
> +                <xs:restriction base="xs:token">
> +                    <xs:enumeration value="true"/>
> +                    <xs:enumeration value="false"/>
> +                </xs:restriction>
> +            </xs:simpleType>
> +        </xs:attribute>
> +    </xs:attributeGroup>
> +    <xs:element name="condition-expr">
> +        <xs:complexType>
> +            <xs:attributeGroup ref="attlist.condition-expr"/>
> +        </xs:complexType>
> +    </xs:element>
> +    <xs:attributeGroup name="attlist.condition-expr">
> +        <xs:attribute name="field-name" type="xs:string" use="required"/>
> +        <xs:attribute name="operator" default="equals">
> +            <xs:simpleType>
> +                <xs:restriction base="xs:token">
> +                    <xs:enumeration value="less"/>
> +                    <xs:enumeration value="greater"/>
> +                    <xs:enumeration value="less-equals"/>
> +                    <xs:enumeration value="greater-equals"/>
> +                    <xs:enumeration value="equals"/>
> +                    <xs:enumeration value="not-equals"/>
> +                    <xs:enumeration value="in"/>
> +                    <xs:enumeration value="between"/>
> +                    <xs:enumeration value="like"/>
> +                </xs:restriction>
> +            </xs:simpleType>
> +        </xs:attribute>
> +        <xs:attribute name="from-field" type="xs:string"/>
> +        <xs:attribute name="value" type="xs:string"/>
> +        <xs:attribute name="ignore-if-null" default="false">
> +            <xs:simpleType>
> +                <xs:restriction base="xs:token">
> +                    <xs:enumeration value="true"/>
> +                    <xs:enumeration value="false"/>
> +                </xs:restriction>
> +            </xs:simpleType>
> +        </xs:attribute>
> +        <xs:attribute name="ignore-if-empty" default="false">
> +            <xs:simpleType>
> +                <xs:restriction base="xs:token">
> +                    <xs:enumeration value="true"/>
> +                    <xs:enumeration value="false"/>
> +                </xs:restriction>
> +            </xs:simpleType>
> +        </xs:attribute>
> +        <xs:attribute name="ignore-case" default="false">
> +            <xs:simpleType>
> +                <xs:restriction base="xs:token">
> +                    <xs:enumeration value="true"/>
> +                    <xs:enumeration value="false"/>
> +                </xs:restriction>
> +            </xs:simpleType>
> +        </xs:attribute>
> +        <xs:attribute name="ignore" default="false">
> +            <xs:annotation>
> +                <xs:documentation>
> +                    Ignore the condition if flag is true.
> +                    Defaults to false.
> +                </xs:documentation>
> +            </xs:annotation>
> +        </xs:attribute>
> +    </xs:attributeGroup>
> +    <xs:element name="condition-list">
> +        <xs:complexType>
> +            <xs:choice maxOccurs="unbounded">
> +                <xs:element ref="condition-expr"/>
> +                <xs:element ref="condition-list"/>
> +                <xs:element ref="condition-object"/>
> +            </xs:choice>
> +            <xs:attributeGroup ref="attlist.condition-list"/>
> +        </xs:complexType>
> +    </xs:element>
> +    <xs:attributeGroup name="attlist.condition-list">
> +        <xs:attribute name="combine" default="and">
> +            <xs:simpleType>
> +                <xs:restriction base="xs:token">
> +                    <xs:enumeration value="and"/>
> +                    <xs:enumeration value="or"/>
> +                </xs:restriction>
> +            </xs:simpleType>
> +        </xs:attribute>
> +    </xs:attributeGroup>
> +    <xs:element name="condition-object">
> +        <xs:complexType>
> +            <xs:attributeGroup ref="attlist.condition-object"/>
> +        </xs:complexType>
> +    </xs:element>
> +    <xs:attributeGroup name="attlist.condition-object">
> +        <xs:attribute name="field" type="xs:string" use="required"/>
> +    </xs:attributeGroup>
> +    <xs:element name="having-condition-list">
> +        <xs:complexType>
> +            <xs:choice maxOccurs="unbounded">
> +                <xs:element ref="condition-expr"/>
> +                <xs:element ref="condition-list"/>
> +                <xs:element ref="condition-object"/>
> +            </xs:choice>
> +            <xs:attributeGroup ref="attlist.having-condition-list"/>
> +        </xs:complexType>
> +    </xs:element>
> +    <xs:attributeGroup name="attlist.having-condition-list">
> +        <xs:attribute name="combine" default="and">
> +            <xs:simpleType>
> +                <xs:restriction base="xs:token">
> +                    <xs:enumeration value="and"/>
> +                    <xs:enumeration value="or"/>
> +                </xs:restriction>
> +            </xs:simpleType>
> +        </xs:attribute>
> +    </xs:attributeGroup>
> +    <xs:element name="order-by">
> +        <xs:complexType>
> +            <xs:attributeGroup ref="attlist.order-by"/>
> +        </xs:complexType>
> +    </xs:element>
> +    <xs:attributeGroup name="attlist.order-by">
> +        <xs:attribute name="field-name" type="xs:string" use="required"/>
> +    </xs:attributeGroup>
> +    
>  
> +    <!-- ================== extend-entity ===================== -->
>      <xs:element name="extend-entity">
>          <xs:complexType>
>              <xs:sequence>
> @@ -452,6 +602,6 @@
>          </xs:complexType>
>      </xs:element>
>      <xs:attributeGroup name="attlist.extend-entity">
> -        <xs:attribute type="xs:string" name="entity-name" use="required"/>
> +        <xs:attribute name="entity-name" type="xs:string" use="required"/>
>      </xs:attributeGroup>
>  </xs:schema>
> 
> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=790472&r1=790471&r2=790472&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original)
> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Thu Jul  2 06:43:50 2009
> @@ -506,16 +506,19 @@
>       *@return ModelFieldType instance for the named type from the helper that corresponds to the specified entity
>       */
>      public ModelFieldType getEntityFieldType(ModelEntity entity, String type) throws GenericEntityException {
> +        return this.getModelFieldTypeReader(entity).getModelFieldType(type);
> +    }
> +    
> +    public ModelFieldTypeReader getModelFieldTypeReader(ModelEntity entity) {
>          String helperName = getEntityHelperName(entity);
> -
> -        if (helperName == null || helperName.length() <= 0)
> +        if (helperName == null || helperName.length() <= 0) {
>              return null;
> +        }
>          ModelFieldTypeReader modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperName);
> -
>          if (modelFieldTypeReader == null) {
> -            throw new GenericEntityException("ModelFieldTypeReader not found for entity " + entity.getEntityName() + " with helper name " + helperName);
> +            throw new IllegalArgumentException("ModelFieldTypeReader not found for entity " + entity.getEntityName() + " with helper name " + helperName);
>          }
> -        return modelFieldTypeReader.getModelFieldType(type);
> +        return modelFieldTypeReader;
>      }
>  
>      /** Gets field type names from the helper that corresponds to the specified entity
> 
> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=790472&r1=790471&r2=790472&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original)
> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Thu Jul  2 06:43:50 2009
> @@ -621,6 +621,11 @@
>          if (modelEntity == null) {
>              return null;
>          }
> +        
> +        ModelViewEntity modelViewEntity = null;
> +        if (modelEntity instanceof ModelViewEntity) {
> +            modelViewEntity = (ModelViewEntity) modelEntity;
> +        }
>  
>          // if no find options passed, use default
>          if (findOptions == null) findOptions = new EntityFindOptions();
> @@ -677,17 +682,30 @@
>          }
>  
>          String viewClause = SqlJdbcUtil.makeViewWhereClause(modelEntity, datasourceInfo.joinStyle);
> -
> -        if (viewClause.length() > 0) {
> -            if (entityCondWhereString.length() > 0) {
> -                whereString.append("(");
> -                whereString.append(entityCondWhereString);
> -                whereString.append(") AND ");
> +        String viewEntityCondWhereString = null;
> +        if (modelViewEntity != null && modelViewEntity.getByConditionFinder() != null) {
> +            EntityCondition viewWhereEntityCondition = modelViewEntity.getByConditionFinder().getWhereEntityCondition(FastMap.<String, Object>newInstance(), modelEntity, this.modelFieldTypeReader);
> +            if (viewWhereEntityCondition != null) {
> +                viewEntityCondWhereString = viewWhereEntityCondition.makeWhereString(modelEntity, whereEntityConditionParams, this.datasourceInfo);
>              }
> +        }
>  
> -            whereString.append(viewClause);
> -        } else {
> +        if (entityCondWhereString.length() > 0) {
> +            whereString.append("(");
>              whereString.append(entityCondWhereString);
> +            whereString.append(")");
> +        }
> +        
> +        if (UtilValidate.isNotEmpty(viewEntityCondWhereString)) {
> +            if (whereString.length() > 0) whereString.append(" AND ");
> +            whereString.append("(");
> +            whereString.append(viewEntityCondWhereString);
> +            whereString.append(")");
> +        }
> +
> +        if (viewClause.length() > 0) {
> +            if (whereString.length() > 0) whereString.append(" AND ");
> +            whereString.append(viewClause);
>          }
>  
>          if (whereString.length() > 0) {
> @@ -696,8 +714,7 @@
>          }
>  
>          // GROUP BY clause for view-entity
> -        if (modelEntity instanceof ModelViewEntity) {
> -            ModelViewEntity modelViewEntity = (ModelViewEntity) modelEntity;
> +        if (modelViewEntity != null) {
>              String groupByString = modelViewEntity.colNameString(modelViewEntity.getGroupBysCopy(selectFields), ", ", "", false);
>  
>              if (UtilValidate.isNotEmpty(groupByString)) {
> @@ -709,17 +726,51 @@
>          // HAVING clause
>          String entityCondHavingString = "";
>          List<EntityConditionParam> havingEntityConditionParams = FastList.newInstance();
> -
>          if (havingEntityCondition != null) {
>              entityCondHavingString = havingEntityCondition.makeWhereString(modelEntity, havingEntityConditionParams, this.datasourceInfo);
>          }
> -        if (entityCondHavingString.length() > 0) {
> +        
> +        String viewEntityCondHavingString = null;
> +        if (modelViewEntity != null && modelViewEntity.getByConditionFinder() != null) {
> +            EntityCondition viewHavingEntityCondition = modelViewEntity.getByConditionFinder().getHavingEntityCondition(FastMap.<String, Object>newInstance(), modelEntity, this.modelFieldTypeReader);
> +            if (viewHavingEntityCondition != null) {
> +                viewEntityCondHavingString = viewHavingEntityCondition.makeWhereString(modelEntity, havingEntityConditionParams, this.datasourceInfo);
> +            }
> +        }
> +
> +        StringBuilder havingString = new StringBuilder();
> +        if (UtilValidate.isNotEmpty(entityCondHavingString)) {
> +            havingString.append("(");
> +            havingString.append(entityCondHavingString);
> +            havingString.append(")");
> +        }
> +        if (UtilValidate.isNotEmpty(viewEntityCondHavingString)) {
> +            if (havingString.length() > 0) havingString.append(" AND ");
> +            havingString.append("(");
> +            havingString.append(viewEntityCondHavingString);
> +            havingString.append(")");
> +        }
> +        
> +        if (havingString.length() > 0) {
>              sqlBuffer.append(" HAVING ");
> -            sqlBuffer.append(entityCondHavingString);
> +            sqlBuffer.append(havingString);
>          }
>  
>          // ORDER BY clause
> -        sqlBuffer.append(SqlJdbcUtil.makeOrderByClause(modelEntity, orderBy, datasourceInfo));
> +        List<String> orderByExpanded = FastList.<String>newInstance();
> +        // add the manually specified ones, then the ones in the view entity's entity-condition
> +        if (orderBy != null) {
> +            orderByExpanded.addAll(orderBy);
> +        }
> +        if (modelViewEntity != null && modelViewEntity.getByConditionFinder() != null) {
> +            List<String> viewOrderBy = modelViewEntity.getByConditionFinder().getOrderByFieldList(FastMap.<String, Object>newInstance());
> +            if (viewOrderBy != null && viewOrderBy.size() > 0) {
> +                orderByExpanded.addAll(viewOrderBy);
> +            }
> +        }
> +        sqlBuffer.append(SqlJdbcUtil.makeOrderByClause(modelEntity, orderByExpanded, datasourceInfo));
> +        
> +        // make the final SQL String
>          String sql = sqlBuffer.toString();
>  
>          SQLProcessor sqlP = new SQLProcessor(helperName);
> 
> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByConditionFinder.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByConditionFinder.java?rev=790472&r1=790471&r2=790472&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByConditionFinder.java (original)
> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByConditionFinder.java Thu Jul  2 06:43:50 2009
> @@ -21,21 +21,20 @@
>  import java.util.Map;
>  
>  import org.ofbiz.base.util.UtilXml;
> -import org.ofbiz.entity.GenericDelegator;
>  import org.ofbiz.entity.condition.EntityCondition;
> -import org.ofbiz.entity.condition.EntityConditionList;
> -import org.ofbiz.entity.condition.EntityJoinOperator;
>  import org.ofbiz.entity.finder.EntityFinderUtil.Condition;
>  import org.ofbiz.entity.finder.EntityFinderUtil.ConditionExpr;
>  import org.ofbiz.entity.finder.EntityFinderUtil.ConditionList;
>  import org.ofbiz.entity.finder.EntityFinderUtil.ConditionObject;
>  import org.ofbiz.entity.model.ModelEntity;
> +import org.ofbiz.entity.model.ModelFieldTypeReader;
>  import org.w3c.dom.Element;
>  
>  /**
>   * Uses the delegator to find entity values by a condition
>   *
>   */
> +@SuppressWarnings("serial")
>  public class ByConditionFinder extends ListFinder {
>      public static final String module = ByConditionFinder.class.getName();
>  
> @@ -59,18 +58,18 @@
>          }
>      }
>  
> -    protected EntityCondition getWhereEntityCondition(Map<String, Object> context, ModelEntity modelEntity, GenericDelegator delegator) {
> +    public EntityCondition getWhereEntityCondition(Map<String, Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader) {
>          // create whereEntityCondition from whereCondition
>          if (this.whereCondition != null) {
> -            return this.whereCondition.createCondition(context, modelEntity.getEntityName(), delegator);
> +            return this.whereCondition.createCondition(context, modelEntity, modelFieldTypeReader);
>          }
>          return null;
>      }
>  
> -    protected EntityCondition getHavingEntityCondition(Map<String, Object> context, ModelEntity modelEntity, GenericDelegator delegator) {
> +    public EntityCondition getHavingEntityCondition(Map<String, Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader) {
>          // create havingEntityCondition from havingCondition
>          if (this.havingCondition != null) {
> -            return this.havingCondition.createCondition(context, modelEntity.getEntityName(), delegator);
> +            return this.havingCondition.createCondition(context, modelEntity, modelFieldTypeReader);
>          }
>          return null;
>      }
> 
> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java?rev=790472&r1=790471&r2=790472&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java (original)
> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java Thu Jul  2 06:43:50 2009
> @@ -18,11 +18,11 @@
>   *******************************************************************************/
>  package org.ofbiz.entity.finder;
>  
> +import static org.ofbiz.base.util.UtilGenerics.cast;
> +
>  import java.io.Serializable;
>  import java.util.Collection;
> -import java.util.HashMap;
>  import java.util.HashSet;
> -import java.util.Iterator;
>  import java.util.LinkedList;
>  import java.util.List;
>  import java.util.Map;
> @@ -31,26 +31,22 @@
>  import javolution.util.FastMap;
>  
>  import org.ofbiz.base.util.Debug;
> -import org.ofbiz.base.util.UtilValidate;
> -import org.ofbiz.base.util.StringUtil;
>  import org.ofbiz.base.util.ObjectType;
> -import static org.ofbiz.base.util.UtilGenerics.cast;
> +import org.ofbiz.base.util.StringUtil;
>  import org.ofbiz.base.util.UtilFormatOut;
> +import org.ofbiz.base.util.UtilValidate;
>  import org.ofbiz.base.util.UtilXml;
>  import org.ofbiz.base.util.collections.FlexibleMapAccessor;
>  import org.ofbiz.base.util.string.FlexibleStringExpander;
> -import org.ofbiz.entity.GenericDelegator;
>  import org.ofbiz.entity.GenericEntityException;
>  import org.ofbiz.entity.GenericValue;
>  import org.ofbiz.entity.condition.EntityComparisonOperator;
>  import org.ofbiz.entity.condition.EntityCondition;
> -import org.ofbiz.entity.condition.EntityConditionList;
> -import org.ofbiz.entity.condition.EntityExpr;
>  import org.ofbiz.entity.condition.EntityFunction;
>  import org.ofbiz.entity.condition.EntityJoinOperator;
>  import org.ofbiz.entity.condition.EntityOperator;
>  import org.ofbiz.entity.model.ModelEntity;
> -import org.ofbiz.entity.model.ModelField;
> +import org.ofbiz.entity.model.ModelFieldTypeReader;
>  import org.ofbiz.entity.util.EntityListIterator;
>  import org.w3c.dom.Element;
>  
> @@ -150,7 +146,7 @@
>      }
>  
>      public static interface Condition extends Serializable {
> -        public EntityCondition createCondition(Map<String, ? extends Object> context, String entityName, GenericDelegator delegator);
> +        public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader);
>      }
>      public static class ConditionExpr implements Condition {
>          protected FlexibleStringExpander fieldNameExdr;
> @@ -182,12 +178,7 @@
>              this.ignoreExdr = FlexibleStringExpander.getInstance(conditionExprElement.getAttribute("ignore"));
>          }
>  
> -        public EntityCondition createCondition(Map<String, ? extends Object> context, String entityName, GenericDelegator delegator) {
> -            ModelEntity modelEntity = delegator.getModelEntity(entityName);
> -            if (modelEntity == null) {
> -                throw new IllegalArgumentException("Error in Entity Find: could not find entity with name [" + entityName + "]");
> -            }
> -
> +        public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader) {
>              String fieldName = fieldNameExdr.expandString(context);
>  
>              Object value = null;
> @@ -221,14 +212,14 @@
>              }
>              
>              if(modelEntity.getField(fieldName) == null) {
> -                throw new IllegalArgumentException("Error in Entity Find: could not find field [" + fieldName + "] in entity with name [" + entityName + "]");
> +                throw new IllegalArgumentException("Error in Entity Find: could not find field [" + fieldName + "] in entity with name [" + modelEntity.getEntityName() + "]");
>              }
>  
>              // don't convert the field to the desired type if this is an IN or BETWEEN operator and we have a Collection
>              if (!((operator == EntityOperator.IN || operator == EntityOperator.BETWEEN)
>                      && value instanceof Collection)) {
>                  // now to a type conversion for the target fieldName
> -                value = modelEntity.convertFieldValue(modelEntity.getField(fieldName), value, delegator, context);
> +                value = modelEntity.convertFieldValue(modelEntity.getField(fieldName), value, modelFieldTypeReader, context);
>              }
>  
>              if (Debug.verboseOn()) Debug.logVerbose("Got value for fieldName [" + fieldName + "]: " + value, module);
> @@ -290,18 +281,18 @@
>              }
>          }
>  
> -        public EntityCondition createCondition(Map<String, ? extends Object> context, String entityName, GenericDelegator delegator) {
> +        public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader) {
>              if (this.conditionList.size() == 0) {
>                  return null;
>              }
>              if (this.conditionList.size() == 1) {
>                  Condition condition = this.conditionList.get(0);
> -                return condition.createCondition(context, entityName, delegator);
> +                return condition.createCondition(context, modelEntity, modelFieldTypeReader);
>              }
>  
>              List<EntityCondition> entityConditionList = new LinkedList<EntityCondition>();
>              for (Condition curCondition: conditionList) {
> -                EntityCondition econd = curCondition.createCondition(context, entityName, delegator);
> +                EntityCondition econd = curCondition.createCondition(context, modelEntity, modelFieldTypeReader);
>                  if (econd != null) {
>                      entityConditionList.add(econd);
>                  }
> @@ -327,7 +318,7 @@
>              }
>          }
>  
> -        public EntityCondition createCondition(Map<String, ? extends Object> context, String entityName, GenericDelegator delegator) {
> +        public EntityCondition createCondition(Map<String, ? extends Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader) {
>              EntityCondition condition = (EntityCondition) fieldNameAcsr.get(context);
>              return condition;
>          }
> 
> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/Finder.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/Finder.java?rev=790472&r1=790471&r2=790472&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/Finder.java (original)
> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/Finder.java Thu Jul  2 06:43:50 2009
> @@ -26,6 +26,7 @@
>  import org.ofbiz.base.util.string.FlexibleStringExpander;
>  import org.ofbiz.entity.GenericDelegator;
>  
> +@SuppressWarnings("serial")
>  public abstract class Finder implements Serializable {
>      protected FlexibleStringExpander entityNameExdr;
>      protected FlexibleStringExpander useCacheStrExdr;
> @@ -42,6 +43,10 @@
>          return entName;
>      }
>  
> +    public void setEntityName(String entityName) {
> +        this.entityNameExdr = FlexibleStringExpander.getInstance(entityName);
> +    }
> +
>      public abstract void runFind(Map<String, Object> context, GenericDelegator delegator) throws GeneralException;
>  }
>  
> 
> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java?rev=790472&r1=790471&r2=790472&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java (original)
> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java Thu Jul  2 06:43:50 2009
> @@ -18,45 +18,42 @@
>   *******************************************************************************/
>  package org.ofbiz.entity.finder;
>  
> +import java.sql.ResultSet;
>  import java.util.List;
>  import java.util.Map;
>  import java.util.Set;
>  
>  import javolution.util.FastList;
> -import javolution.util.FastMap;
>  
>  import org.ofbiz.base.util.Debug;
>  import org.ofbiz.base.util.GeneralException;
> +import org.ofbiz.base.util.UtilMisc;
>  import org.ofbiz.base.util.UtilValidate;
>  import org.ofbiz.base.util.UtilXml;
> -import org.ofbiz.base.util.UtilMisc;
>  import org.ofbiz.base.util.collections.FlexibleMapAccessor;
>  import org.ofbiz.base.util.string.FlexibleStringExpander;
>  import org.ofbiz.entity.GenericDelegator;
>  import org.ofbiz.entity.GenericEntityException;
>  import org.ofbiz.entity.GenericValue;
>  import org.ofbiz.entity.condition.EntityCondition;
> -import org.ofbiz.entity.condition.EntityConditionList;
> -import org.ofbiz.entity.condition.EntityJoinOperator;
>  import org.ofbiz.entity.finder.EntityFinderUtil.GetAll;
>  import org.ofbiz.entity.finder.EntityFinderUtil.LimitRange;
>  import org.ofbiz.entity.finder.EntityFinderUtil.LimitView;
>  import org.ofbiz.entity.finder.EntityFinderUtil.OutputHandler;
>  import org.ofbiz.entity.finder.EntityFinderUtil.UseIterator;
>  import org.ofbiz.entity.model.ModelEntity;
> +import org.ofbiz.entity.model.ModelFieldTypeReader;
>  import org.ofbiz.entity.transaction.TransactionUtil;
>  import org.ofbiz.entity.util.EntityFindOptions;
>  import org.ofbiz.entity.util.EntityListIterator;
>  import org.ofbiz.entity.util.EntityUtil;
>  import org.w3c.dom.Element;
>  
> -import java.io.Serializable;
> -import java.sql.ResultSet;
> -
>  /**
>   * Uses the delegator to find entity values by a and
>   *
>   */
> +@SuppressWarnings("serial")
>  public abstract class ListFinder extends Finder {
>      public static final String module = ListFinder.class.getName();
>  
> @@ -141,8 +138,8 @@
>              delegator = GenericDelegator.getGenericDelegator(delegatorName);
>          }
>  
> -        EntityCondition whereEntityCondition = getWhereEntityCondition(context, modelEntity, delegator);
> -        EntityCondition havingEntityCondition = getHavingEntityCondition(context, modelEntity, delegator);
> +        EntityCondition whereEntityCondition = getWhereEntityCondition(context, modelEntity, delegator.getModelFieldTypeReader(modelEntity));
> +        EntityCondition havingEntityCondition = getHavingEntityCondition(context, modelEntity, delegator.getModelFieldTypeReader(modelEntity));
>          if (useCache) {
>              // if useCache == true && outputHandler instanceof UseIterator, throw exception; not a valid combination
>              if (outputHandler instanceof UseIterator) {
> @@ -224,12 +221,17 @@
>              throw new GeneralException(errMsg, e);
>          }
>      }
> +    
> +    public List<String> getOrderByFieldList(Map<String, Object> context) {
> +        List<String> orderByFields = EntityFinderUtil.makeOrderByFieldList(this.orderByExpanderList, context);
> +        return orderByFields;
> +    }
>  
> -    protected EntityCondition getWhereEntityCondition(Map<String, Object> context, ModelEntity modelEntity, GenericDelegator delegator) {
> +    public EntityCondition getWhereEntityCondition(Map<String, Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader) {
>          return null;
>      }
>  
> -    protected EntityCondition getHavingEntityCondition(Map<String, Object> context, ModelEntity modelEntity, GenericDelegator delegator) {
> +    public EntityCondition getHavingEntityCondition(Map<String, Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader) {
>          return null;
>      }
>  }
> 
> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java?rev=790472&r1=790471&r2=790472&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Thu Jul  2 06:43:50 2009
> @@ -55,6 +55,7 @@
>   * Generic Entity - Entity model class
>   *
>   */
> +@SuppressWarnings("serial")
>  public class ModelEntity extends ModelInfo implements Comparable<ModelEntity>, Serializable {
>  
>      public static final String module = ModelEntity.class.getName();
> @@ -1297,24 +1298,22 @@
>      /** Convert a field value from one Java data type to another. This is the preferred method -
>       * which takes into consideration the user's locale and time zone (for conversions that
>       * require them).
> -     * @param modelField
> -     * @param value
> -     * @param delegator
> -     * @param context
>       * @return the converted value
>       */
>      public Object convertFieldValue(ModelField modelField, Object value, GenericDelegator delegator, Map<String, ? extends Object> context) {
> +        ModelFieldTypeReader modelFieldTypeReader = delegator.getModelFieldTypeReader(this);
> +        return this.convertFieldValue(modelField, value, modelFieldTypeReader, context);
> +    }
> +    /** Convert a field value from one Java data type to another. This is the preferred method -
> +     * which takes into consideration the user's locale and time zone (for conversions that
> +     * require them).
> +     * @return the converted value
> +     */
> +    public Object convertFieldValue(ModelField modelField, Object value, ModelFieldTypeReader modelFieldTypeReader, Map<String, ? extends Object> context) {
>          if (value == null || value == GenericEntity.NULL_FIELD) {
>              return null;
>          }
> -        String fieldJavaType = null;
> -        try {
> -            fieldJavaType = delegator.getEntityFieldType(this, modelField.getType()).getJavaType();
> -        } catch (GenericEntityException e) {
> -            String errMsg = "Could not convert field value: could not find Java type for the field: [" + modelField.getName() + "] on the [" + this.getEntityName() + "] entity: " + e.toString();
> -            Debug.logError(e, errMsg, module);
> -            throw new IllegalArgumentException(errMsg);
> -        }
> +        String fieldJavaType = modelFieldTypeReader.getModelFieldType(modelField.getType()).getJavaType();
>          try {
>              return ObjectType.simpleTypeConvert(value, fieldJavaType, null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true);
>          } catch (GeneralException e) {
> 
> 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=790472&r1=790471&r2=790472&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 Thu Jul  2 06:43:50 2009
> @@ -33,8 +33,8 @@
>  import org.ofbiz.base.util.UtilTimer;
>  import org.ofbiz.base.util.UtilValidate;
>  import org.ofbiz.base.util.UtilXml;
> -import org.ofbiz.entity.GenericEntity;
>  import org.ofbiz.entity.condition.EntityOperator;
> +import org.ofbiz.entity.finder.ByConditionFinder;
>  import org.ofbiz.entity.jdbc.SqlJdbcUtil;
>  import org.w3c.dom.Element;
>  import org.w3c.dom.NodeList;
> @@ -42,6 +42,7 @@
>  /**
>   * This class extends ModelEntity and provides additional information appropriate to view entities
>   */
> +@SuppressWarnings("serial")
>  public class ModelViewEntity extends ModelEntity {
>      public static final String module = ModelViewEntity.class.getName();
>  
> @@ -79,6 +80,8 @@
>      protected List<ModelField> groupBys = FastList.newInstance();
>  
>      protected Map<String, Map<String, ModelConversion>> conversions = FastMap.newInstance();
> +    
> +    protected ByConditionFinder byConditionFinder = null;
>  
>      public ModelViewEntity(ModelReader reader, Element entityElement, UtilTimer utilTimer, ModelInfo def) {
>          super(reader, entityElement, def);
> @@ -118,6 +121,13 @@
>  
>          if (utilTimer != null) utilTimer.timerString("  createModelEntity: before relations");
>          this.populateRelated(reader, entityElement);
> +        
> +        Element entityConditionElement = UtilXml.firstChildElement(entityElement, "entity-condition");
> +        if (entityConditionElement != null) {
> +            this.byConditionFinder = new ByConditionFinder(entityConditionElement);
> +            // make sure the entity name is set since the XML for this particular condition doesn't allow it
> +            this.byConditionFinder.setEntityName(this.entityName);
> +        }
>  
>          // before finishing, make sure the table name is null, this should help bring up errors early...
>          this.tableName = null;
> @@ -266,6 +276,10 @@
>      public void addViewLink(ModelViewLink viewLink) {
>          this.viewLinks.add(viewLink);
>      }
> +    
> +    public ByConditionFinder getByConditionFinder() {
> +        return this.byConditionFinder;
> +    }
>  
>      public String colNameString(String separator, String afterLast, boolean alias, ModelField... flds) {
>          return colNameString(Arrays.asList(flds), separator, afterLast, alias);
> 
> Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java?rev=790472&r1=790471&r2=790472&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java (original)
> +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java Thu Jul  2 06:43:50 2009
> @@ -32,6 +32,7 @@
>  import org.ofbiz.entity.finder.EntityFinderUtil.ConditionExpr;
>  import org.ofbiz.entity.finder.EntityFinderUtil.ConditionList;
>  import org.ofbiz.entity.finder.EntityFinderUtil.ConditionObject;
> +import org.ofbiz.entity.model.ModelEntity;
>  import org.ofbiz.minilang.SimpleMethod;
>  import org.ofbiz.minilang.method.MethodContext;
>  import org.ofbiz.minilang.method.MethodOperation;
> @@ -102,16 +103,18 @@
>                  delegator = GenericDelegator.getGenericDelegator(delegatorName);
>              }
>  
> +            ModelEntity modelEntity = delegator.getModelEntity(entityName);
> +            
>              // create whereEntityCondition from whereCondition
>              EntityCondition whereEntityCondition = null;
>              if (this.whereCondition != null) {
> -                whereEntityCondition = this.whereCondition.createCondition(context, entityName, delegator);
> +                whereEntityCondition = this.whereCondition.createCondition(context, modelEntity, delegator.getModelFieldTypeReader(modelEntity));
>              }
>  
>              // create havingEntityCondition from havingCondition
>              EntityCondition havingEntityCondition = null;
>              if (this.havingCondition != null) {
> -                havingEntityCondition = this.havingCondition.createCondition(context, entityName, delegator);
> +                havingEntityCondition = this.havingCondition.createCondition(context, modelEntity, delegator.getModelFieldTypeReader(modelEntity));
>              }
>  
>              long count = delegator.findCountByCondition(entityName, whereEntityCondition, havingEntityCondition, null);
> 
> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=790472&r1=790471&r2=790472&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original)
> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Thu Jul  2 06:43:50 2009
> @@ -1703,7 +1703,8 @@
>              if (UtilValidate.isNotEmpty(this.constraintList)) {
>                  List<EntityCondition> expandedConditionList = new LinkedList<EntityCondition>();
>                  for (EntityFinderUtil.Condition condition: constraintList) {
> -                    expandedConditionList.add(condition.createCondition(context, this.entityName, delegator));
> +                    ModelEntity modelEntity = delegator.getModelEntity(this.entityName);
> +                    expandedConditionList.add(condition.createCondition(context, modelEntity, delegator.getModelFieldTypeReader(modelEntity)));
>                  }
>                  findCondition = EntityCondition.makeCondition(expandedConditionList);
>              }
> 
> 
-- 
Antwebsystems.com: Quality OFBiz services for competitive rates