Improve FindGeneric on webtools

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

Improve FindGeneric on webtools

Nicolas Malin-2

Hello, I want just sharing a small improvement realized  yesterday.

During a travel, I was bored on the train I tried to replace the old ftl FindGeneric screen to display and search all entity by an xml form with auto-attribute-entity.

The main problem came from it's impossible to create a xml file with use dynamiclay an entityName for the element <auto-fields-entity> (for cache/performance reason) so I tried to generate on the fly by groovy the xml flow, and call without cache the rendering, like this :
*****
String dynamicAutoEntityFieldForm = '<?xml version="1.0" encoding="UTF-8"?><forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">'
        '<form name="FindGeneric" type="single" target="FindGeneric">' +
        '<auto-fields-entity entity-name="' + entityName + '" default-field-type="find"/>' +
        '<field name="noConditionFind"><hidden value="Y"/></field>' +
        '<field name="entityName"><hidden value="' + entityName + '"/></field>' +
        '<field name="searchButton" title="' + UtilProperties.getMessage("CommonUiLabels", "FormFieldTitle_searchButton", locale) + '"><submit/></field>' +
        '</form></forms>'
    Document dynamicAutoEntityFieldFormXml = UtilXml.readXmlDocument(dynamicAutoEntityFieldForm, true, true)
    [...]
    dynamicAutoEntitySearchFormRenderer.render(writer, context)
****
and on the ftl
****
${dynamicAutoEntitySearchForm?string}
****
I realized this on the search and list form so now I can use complex search operator and the performFind for all entity. What do you thinks about that ?

I will open an issue.

Nicolas


--
logoNrd
Nicolas Malin
The apache way : Openness Technical decisions are made publicly
[hidden email]

8 rue des Déportés 37000 TOURS, 02 47 50 30 54
Apache OFBiz|The Apache Way|ofbiz-fr|réseau LE
Reply | Threaded
Open this post in threaded view
|

Re: Improve FindGeneric on webtools

Rishi Solanki
+1

Rishi Solanki
Sr. Manager, Enterprise Software Development
HotWax Systems Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxsystems.com

On Thu, Feb 16, 2017 at 3:31 PM, Nicolas Malin <[hidden email]> wrote:

Hello, I want just sharing a small improvement realized  yesterday.

During a travel, I was bored on the train I tried to replace the old ftl FindGeneric screen to display and search all entity by an xml form with auto-attribute-entity.

The main problem came from it's impossible to create a xml file with use dynamiclay an entityName for the element <auto-fields-entity> (for cache/performance reason) so I tried to generate on the fly by groovy the xml flow, and call without cache the rendering, like this :
*****
String dynamicAutoEntityFieldForm = '<?xml version="1.0" encoding="UTF-8"?><forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">'
        '<form name="FindGeneric" type="single" target="FindGeneric">' +
        '<auto-fields-entity entity-name="' + entityName + '" default-field-type="find"/>' +
        '<field name="noConditionFind"><hidden value="Y"/></field>' +
        '<field name="entityName"><hidden value="' + entityName + '"/></field>' +
        '<field name="searchButton" title="' + UtilProperties.getMessage("CommonUiLabels", "FormFieldTitle_searchButton", locale) + '"><submit/></field>' +
        '</form></forms>'
    Document dynamicAutoEntityFieldFormXml = UtilXml.readXmlDocument(dynamicAutoEntityFieldForm, true, true)
    [...]
    dynamicAutoEntitySearchFormRenderer.render(writer, context)
****
and on the ftl
****
${dynamicAutoEntitySearchForm?string}
****
I realized this on the search and list form so now I can use complex search operator and the performFind for all entity. What do you thinks about that ?

I will open an issue.

Nicolas


--

Nicolas Malin
The apache way : Openness Technical decisions are made publicly
[hidden email]

8 rue des Déportés 37000 TOURS, 02 47 50 30 54
Apache OFBiz|The Apache Way|ofbiz-fr|réseau LE

Reply | Threaded
Open this post in threaded view
|

Re: Improve FindGeneric on webtools

Nicolas Malin-2
I opened the issue https://issues.apache.org/jira/browse/OFBIZ-9217

It's not finish yet but already usefull ;)

Nicolas

Le 17/02/2017 à 06:24, Rishi Solanki a écrit :

> +1
>
>
> On Thu, Feb 16, 2017 at 3:31 PM, Nicolas Malin
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     Hello, I want just sharing a small improvement realized  yesterday.
>
>     During a travel, I was bored on the train I tried to replace the
>     old ftl FindGeneric screen to display and search all entity by an
>     xml form with auto-attribute-entity.
>
>     The main problem came from it's impossible to create a xml file
>     with use dynamiclay an entityName for the element
>     <auto-fields-entity> (for cache/performance reason) so I tried to
>     generate on the fly by groovy the xml flow, and call without cache
>     the rendering, like this :
>     *****
>     String dynamicAutoEntityFieldForm = '<?xml version="1.0"
>     encoding="UTF-8"?><forms
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     <http://www.w3.org/2001/XMLSchema-instance>
>     xmlns="http://ofbiz.apache.org/Widget-Form"
>     <http://ofbiz.apache.org/Widget-Form>
>     xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form
>     http://ofbiz.apache.org/dtds/widget-form.xsd"
>     <http://ofbiz.apache.org/Widget-Formhttp://ofbiz.apache.org/dtds/widget-form.xsd>>'
>
>             '<form name="FindGeneric" type="single"
>     target="FindGeneric">' +
>             '<auto-fields-entity entity-name="' + entityName + '"
>     default-field-type="find"/>' +
>             '<field name="noConditionFind"><hidden value="Y"/></field>' +
>             '<field name="entityName"><hidden value="' + entityName +
>     '"/></field>' +
>             '<field name="searchButton" title="' +
>     UtilProperties.getMessage("CommonUiLabels",
>     "FormFieldTitle_searchButton", locale) + '"><submit/></field>' +
>             '</form></forms>'
>         Document dynamicAutoEntityFieldFormXml =
>     UtilXml.readXmlDocument(dynamicAutoEntityFieldForm, true, true)
>         [...]
>         dynamicAutoEntitySearchFormRenderer.render(writer, context)
>     ****
>     and on the ftl
>     ****
>     ${dynamicAutoEntitySearchForm?string}
>     ****
>     I realized this on the search and list form so now I can use
>     complex search operator and the performFind for all entity. What
>     do you thinks about that ?
>
>     I will open an issue.
>
>     Nicolas
>
>
>     --
>     logoNrd <https://nereide.fr/>
>     Nicolas Malin
>     The apache way <http://theapacheway.com/> : *Openness* Technical
>     decisions are made publicly
>     [hidden email] <mailto:[hidden email]>
>     8 rue des Déportés 37000 TOURS, 02 47 50 30 54
>
>     Apache OFBiz <http://ofbiz.apache.org/>|The Apache Way
>     <http://theapacheway.com/>|ofbiz-fr
>     <http://www.ofbiz-fr.org/>|réseau LE
>     <http://www.libre-entreprise.org/>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Improve FindGeneric on webtools

taher
Great initiative Nicolas.

I remember once trying to extend the functionality of performFind but it
contained so much logic that I couldn't reuse it in any reasonable way. The
entire implementation of find services needs heavy refactoring or
replacement because it tries to do everything (searching, parsing,
paginating, displaying, validating). It's just one big monster

I would recommend instead of creating new services, trying to replace the
existing ones (if possible and you go the energy). I think we need multiple
separate components (parser, renderer, paginator, searcher, etc ...). It
would be really great to have small specialized classes or groovy scripts
that split the responsibility instead of this painful implementation we
have at the moment.

On Fri, Feb 17, 2017 at 11:04 AM, Nicolas Malin <[hidden email]>
wrote:

> I opened the issue https://issues.apache.org/jira/browse/OFBIZ-9217
>
> It's not finish yet but already usefull ;)
>
> Nicolas
>
> Le 17/02/2017 à 06:24, Rishi Solanki a écrit :
>
>> +1
>>
>>
>> On Thu, Feb 16, 2017 at 3:31 PM, Nicolas Malin <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>>     Hello, I want just sharing a small improvement realized  yesterday.
>>
>>     During a travel, I was bored on the train I tried to replace the
>>     old ftl FindGeneric screen to display and search all entity by an
>>     xml form with auto-attribute-entity.
>>
>>     The main problem came from it's impossible to create a xml file
>>     with use dynamiclay an entityName for the element
>>     <auto-fields-entity> (for cache/performance reason) so I tried to
>>     generate on the fly by groovy the xml flow, and call without cache
>>     the rendering, like this :
>>     *****
>>     String dynamicAutoEntityFieldForm = '<?xml version="1.0"
>>     encoding="UTF-8"?><forms
>>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>     <http://www.w3.org/2001/XMLSchema-instance>
>>     xmlns="http://ofbiz.apache.org/Widget-Form"
>>     <http://ofbiz.apache.org/Widget-Form>
>>     xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form
>>     http://ofbiz.apache.org/dtds/widget-form.xsd"
>>     <http://ofbiz.apache.org/Widget-Formhttp://ofbiz.apache.org/
>> dtds/widget-form.xsd>>'
>>
>>
>>             '<form name="FindGeneric" type="single"
>>     target="FindGeneric">' +
>>             '<auto-fields-entity entity-name="' + entityName + '"
>>     default-field-type="find"/>' +
>>             '<field name="noConditionFind"><hidden value="Y"/></field>' +
>>             '<field name="entityName"><hidden value="' + entityName +
>>     '"/></field>' +
>>             '<field name="searchButton" title="' +
>>     UtilProperties.getMessage("CommonUiLabels",
>>     "FormFieldTitle_searchButton", locale) + '"><submit/></field>' +
>>             '</form></forms>'
>>         Document dynamicAutoEntityFieldFormXml =
>>     UtilXml.readXmlDocument(dynamicAutoEntityFieldForm, true, true)
>>         [...]
>>         dynamicAutoEntitySearchFormRenderer.render(writer, context)
>>     ****
>>     and on the ftl
>>     ****
>>     ${dynamicAutoEntitySearchForm?string}
>>     ****
>>     I realized this on the search and list form so now I can use
>>     complex search operator and the performFind for all entity. What
>>     do you thinks about that ?
>>
>>     I will open an issue.
>>
>>     Nicolas
>>
>>
>>     --     logoNrd <https://nereide.fr/>
>>         Nicolas Malin
>>     The apache way <http://theapacheway.com/> : *Openness* Technical
>>     decisions are made publicly
>>     [hidden email] <mailto:[hidden email]>
>>     8 rue des Déportés 37000 TOURS, 02 47 50 30 54
>>
>>     Apache OFBiz <http://ofbiz.apache.org/>|The Apache Way
>>     <http://theapacheway.com/>|ofbiz-fr
>>     <http://www.ofbiz-fr.org/>|réseau LE
>>     <http://www.libre-entreprise.org/>
>>
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Improve FindGeneric on webtools

Jacques Le Roux
Administrator
That's certainly a good idea Taher,

In the meantime I like Nicolas's proposition, notably to be able to search on dates!

Jacques


Le 17/02/2017 à 09:13, Taher Alkhateeb a écrit :

> Great initiative Nicolas.
>
> I remember once trying to extend the functionality of performFind but it
> contained so much logic that I couldn't reuse it in any reasonable way. The
> entire implementation of find services needs heavy refactoring or
> replacement because it tries to do everything (searching, parsing,
> paginating, displaying, validating). It's just one big monster
>
> I would recommend instead of creating new services, trying to replace the
> existing ones (if possible and you go the energy). I think we need multiple
> separate components (parser, renderer, paginator, searcher, etc ...). It
> would be really great to have small specialized classes or groovy scripts
> that split the responsibility instead of this painful implementation we
> have at the moment.
>
> On Fri, Feb 17, 2017 at 11:04 AM, Nicolas Malin <[hidden email]>
> wrote:
>
>> I opened the issue https://issues.apache.org/jira/browse/OFBIZ-9217
>>
>> It's not finish yet but already usefull ;)
>>
>> Nicolas
>>
>> Le 17/02/2017 à 06:24, Rishi Solanki a écrit :
>>
>>> +1
>>>
>>>
>>> On Thu, Feb 16, 2017 at 3:31 PM, Nicolas Malin <[hidden email]
>>> <mailto:[hidden email]>> wrote:
>>>
>>>      Hello, I want just sharing a small improvement realized  yesterday.
>>>
>>>      During a travel, I was bored on the train I tried to replace the
>>>      old ftl FindGeneric screen to display and search all entity by an
>>>      xml form with auto-attribute-entity.
>>>
>>>      The main problem came from it's impossible to create a xml file
>>>      with use dynamiclay an entityName for the element
>>>      <auto-fields-entity> (for cache/performance reason) so I tried to
>>>      generate on the fly by groovy the xml flow, and call without cache
>>>      the rendering, like this :
>>>      *****
>>>      String dynamicAutoEntityFieldForm = '<?xml version="1.0"
>>>      encoding="UTF-8"?><forms
>>>      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>      <http://www.w3.org/2001/XMLSchema-instance>
>>>      xmlns="http://ofbiz.apache.org/Widget-Form"
>>>      <http://ofbiz.apache.org/Widget-Form>
>>>      xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form
>>>      http://ofbiz.apache.org/dtds/widget-form.xsd"
>>>      <http://ofbiz.apache.org/Widget-Formhttp://ofbiz.apache.org/
>>> dtds/widget-form.xsd>>'
>>>
>>>
>>>              '<form name="FindGeneric" type="single"
>>>      target="FindGeneric">' +
>>>              '<auto-fields-entity entity-name="' + entityName + '"
>>>      default-field-type="find"/>' +
>>>              '<field name="noConditionFind"><hidden value="Y"/></field>' +
>>>              '<field name="entityName"><hidden value="' + entityName +
>>>      '"/></field>' +
>>>              '<field name="searchButton" title="' +
>>>      UtilProperties.getMessage("CommonUiLabels",
>>>      "FormFieldTitle_searchButton", locale) + '"><submit/></field>' +
>>>              '</form></forms>'
>>>          Document dynamicAutoEntityFieldFormXml =
>>>      UtilXml.readXmlDocument(dynamicAutoEntityFieldForm, true, true)
>>>          [...]
>>>          dynamicAutoEntitySearchFormRenderer.render(writer, context)
>>>      ****
>>>      and on the ftl
>>>      ****
>>>      ${dynamicAutoEntitySearchForm?string}
>>>      ****
>>>      I realized this on the search and list form so now I can use
>>>      complex search operator and the performFind for all entity. What
>>>      do you thinks about that ?
>>>
>>>      I will open an issue.
>>>
>>>      Nicolas
>>>
>>>
>>>      --     logoNrd <https://nereide.fr/>
>>>          Nicolas Malin
>>>      The apache way <http://theapacheway.com/> : *Openness* Technical
>>>      decisions are made publicly
>>>      [hidden email] <mailto:[hidden email]>
>>>      8 rue des Déportés 37000 TOURS, 02 47 50 30 54
>>>
>>>      Apache OFBiz <http://ofbiz.apache.org/>|The Apache Way
>>>      <http://theapacheway.com/>|ofbiz-fr
>>>      <http://www.ofbiz-fr.org/>|réseau LE
>>>      <http://www.libre-entreprise.org/>
>>>
>>>
>>>
>