Hi Jacopo,

sure that would be nicer but much more involved....although using
sections and conditions already somewhat allows this....

what i committed now is a simple solution for a simple problem......

Bruno, what do you think?


On Thu, 2008-08-28 at 12:51 +0530, Jacopo Cappellato wrote:
> Instead of this feature, I would have preferred to see implemented an  
> <if> element for actions.
> In this way you could do:
> 
> <if>...condition...
> <then>
> entity find with all the exprs
> </then>
> <else>
> entity find without the expr you want to skip
> </else>
> </if>
> 
> This is my opinion is more flexible and general purpose approach.
> I am worried about the readability of the "ignore" attribute...
> 
> Jacopo
> 
> 
> On Aug 28, 2008, at 9:47 AM, [EMAIL PROTECTED] wrote:
> 
> > Author: hansbak
> > Date: Wed Aug 27 21:17:48 2008
> > New Revision: 689713
> >
> > URL: http://svn.apache.org/viewvc?rev=689713&view=rev
> > Log:
> > OFBIZ-1934: Ignore property for condition-expr tag, excellent  
> > contribution by Bruno Busco
> >
> > Modified:
> >  ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ 
> > EntityFinderUtil.java
> >  ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd
> >  ofbiz/trunk/framework/widget/dtd/widget-form.xsd
> >  ofbiz/trunk/framework/widget/dtd/widget-screen.xsd
> >  ofbiz/trunk/framework/widget/dtd/widget-tree.xsd
> >
> > 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=689713&r1=689712&r2=689713&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 Wed Aug 27 21:17:48 2008
> > @@ -154,6 +154,7 @@
> >       protected FlexibleStringExpander operatorExdr;
> >       protected FlexibleMapAccessor<Object> envNameAcsr;
> >       protected FlexibleStringExpander valueExdr;
> > +        protected FlexibleStringExpander ignoreExdr;
> >       protected boolean ignoreIfNull;
> >       protected boolean ignoreIfEmpty;
> >       protected boolean ignoreCase;
> > @@ -171,6 +172,7 @@
> >           this.ignoreIfNull =  
> > "true".equals(conditionExprElement.getAttribute("ignore-if-null"));
> >           this.ignoreIfEmpty =  
> > "true".equals(conditionExprElement.getAttribute("ignore-if-empty"));
> >           this.ignoreCase =  
> > "true".equals(conditionExprElement.getAttribute("ignore-case"));
> > +            this.ignoreExdr =  
> > FlexibleStringExpander 
> > .getInstance(conditionExprElement.getAttribute("ignore"));
> >       }
> >
> >       public EntityCondition createCondition(Map<String, ? extends  
> > Object> context, String entityName, GenericDelegator delegator) {
> > @@ -225,6 +227,10 @@
> >               return null;
> >           }
> >
> > +            if  
> > ("true".equals(this.ignoreExdr.expandString(context))) {
> > +                return null;
> > +            }
> > +
> >           if (operator == EntityOperator.NOT_EQUAL && value != null) {
> >               // since some databases don't consider nulls in !=  
> > comparisons, explicitly include them
> >               // this makes more sense logically, but if anyone ever  
> > needs it to not behave this way we should add an "or-null" attribute  
> > that is true by default
> >
> > Modified: ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd
> > URL: 
> > http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd?rev=689713&r1=689712&r2=689713&view=diff
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > ======================================================================
> > --- ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd (original)
> > +++ ofbiz/trunk/framework/minilang/dtd/simple-methods.xsd Wed Aug 27  
> > 21:17:48 2008
> > @@ -2643,6 +2643,14 @@
> >               </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-object">
> >       <xs:annotation>
> >
> > Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd
> > URL: 
> > http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?rev=689713&r1=689712&r2=689713&view=diff
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > ======================================================================
> > --- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original)
> > +++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Wed Aug 27  
> > 21:17:48 2008
> > @@ -1594,6 +1594,14 @@
> >               </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>
> >
> > Modified: ofbiz/trunk/framework/widget/dtd/widget-screen.xsd
> > URL: 
> > http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-screen.xsd?rev=689713&r1=689712&r2=689713&view=diff
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > ======================================================================
> > --- ofbiz/trunk/framework/widget/dtd/widget-screen.xsd (original)
> > +++ ofbiz/trunk/framework/widget/dtd/widget-screen.xsd Wed Aug 27  
> > 21:17:48 2008
> > @@ -669,6 +669,14 @@
> >               </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-object">
> >       <xs:complexType>
> >
> > Modified: ofbiz/trunk/framework/widget/dtd/widget-tree.xsd
> > URL: 
> > http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-tree.xsd?rev=689713&r1=689712&r2=689713&view=diff
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > ======================================================================
> > --- ofbiz/trunk/framework/widget/dtd/widget-tree.xsd (original)
> > +++ ofbiz/trunk/framework/widget/dtd/widget-tree.xsd Wed Aug 27  
> > 21:17:48 2008
> > @@ -504,6 +504,14 @@
> >               </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>
> >
> >   <!-- ================ CONDITIONS ================ -->
> >
> >
> 
-- 
Antwebsystems.com: Quality OFBiz services for competitive prices

Reply via email to