You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Nicolas Malin <ni...@nereide.fr> on 2017/07/22 18:26:06 UTC

Service error label wit automatic resolution

Hello,
After review some issue related to 
https://issues.apache.org/jira/browse/OFBIZ-7471, my head raise an old 
idea that have been in the past to improve error message on service 
validation.
Currently to set an error message related to an attribute, we need to 
set it like this :
         <attribute name="file" type="String" mode="IN" optional="false">
             <type-validate>
                 <fail-property resource="ContentErrorUiLabels" 
property="ContentRequiredFieldMissingFile"/>
             </type-validate>
         </attribute>
I find this burden, to write and to read.

Maybe we can improve OFBiz to resolve le label automatically with few 
easy rule like :
write title error label with the template 
ServiceErrorTitle_${serviceName}_${attribute}, if not found resolve the 
generic ServiceErrorTitle_${serviceName}, if not found resolve 
ServiceErrorTitle_${attribute}
All service label files would be identify to load in cache at ofbiz start.
I think it's :
* easy to develop
* easy to maintain
* don't decrease the performance

Opinions ?

Nicolas

-- 
logoNrd <https://nereide.fr/>
	Nicolas Malin
The apache way <http://theapacheway.com/> : *Openness* Technical 
decisions are made publicly
information@nereide.fr
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/>

Re: Service error label wit automatic resolution

Posted by Nicolas Malin <ni...@nereide.fr>.
Hi Phaul,

I agree for "Missing" but you also can have a type conversion problem. 
But no worries.
I get an example for ServiceErrorTitle_${serviceName}

I create the service createMyHome with 200 attributes and define this :
(I use properties syntax for simplify)

ServiceErrorTitle_createMyHome=Oh to create my home you forget some parameters :

ServiceErrorTitle_createMyHome_Missing_address=To create my home I need to know where, please give me an address.


When I call create my home and forget address, OFBiz return :

To create my home I need to know where, please give me an address.


But When I forget doorSize, colorToilet  OFBiz return :

Oh to create my home you forget some parameters: doorSize, colorToilet


Perhaps it's more clear :)
Cheers,
Nicolas

Le 23/07/2017 à 08:03, Paul Foxworthy a écrit :
> Hi Nicholas,
>
> Are you proposing these labels would be used when there's a missing
> parameter to a service? If that's right, the names of labels should
> communicate they are about missing parameters.
>
> How about ServiceErrorTitle_${serviceName}_Missing_${attribute} and
> ServiceErrorTitle_Missing_${attribute}
> . I don't understand when ServiceErrorTitle_${serviceName} would be used.
>
> Cheers
>
> Paul Foxworthy
>
>
> On 23 July 2017 at 04:26, Nicolas Malin <ni...@nereide.fr> wrote:
>
>> Hello,
>> After review some issue related to https://issues.apache.org/jira
>> /browse/OFBIZ-7471, my head raise an old idea that have been in the past
>> to improve error message on service validation.
>> Currently to set an error message related to an attribute, we need to set
>> it like this :
>>          <attribute name="file" type="String" mode="IN" optional="false">
>>              <type-validate>
>>                  <fail-property resource="ContentErrorUiLabels"
>> property="ContentRequiredFieldMissingFile"/>
>>              </type-validate>
>>          </attribute>
>> I find this burden, to write and to read.
>>
>> Maybe we can improve OFBiz to resolve le label automatically with few easy
>> rule like :
>> write title error label with the template ServiceErrorTitle_${serviceName}_${attribute},
>> if not found resolve the generic ServiceErrorTitle_${serviceName}, if not
>> found resolve ServiceErrorTitle_${attribute}
>> All service label files would be identify to load in cache at ofbiz start.
>> I think it's :
>> * easy to develop
>> * easy to maintain
>> * don't decrease the performance
>>
>> Opinions ?
>>
>> Nicolas
>>
>> --
>> logoNrd <https://nereide.fr/>
>>          Nicolas Malin
>> The apache way <http://theapacheway.com/> : *Openness* Technical
>> decisions are made publicly
>> information@nereide.fr
>> 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/>
>>
>
>


Re: Service error label wit automatic resolution

Posted by Paul Foxworthy <pa...@cohsoft.com.au>.
Hi Nicholas,

Are you proposing these labels would be used when there's a missing
parameter to a service? If that's right, the names of labels should
communicate they are about missing parameters.

How about ServiceErrorTitle_${serviceName}_Missing_${attribute} and
ServiceErrorTitle_Missing_${attribute}
. I don't understand when ServiceErrorTitle_${serviceName} would be used.

Cheers

Paul Foxworthy


On 23 July 2017 at 04:26, Nicolas Malin <ni...@nereide.fr> wrote:

> Hello,
> After review some issue related to https://issues.apache.org/jira
> /browse/OFBIZ-7471, my head raise an old idea that have been in the past
> to improve error message on service validation.
> Currently to set an error message related to an attribute, we need to set
> it like this :
>         <attribute name="file" type="String" mode="IN" optional="false">
>             <type-validate>
>                 <fail-property resource="ContentErrorUiLabels"
> property="ContentRequiredFieldMissingFile"/>
>             </type-validate>
>         </attribute>
> I find this burden, to write and to read.
>
> Maybe we can improve OFBiz to resolve le label automatically with few easy
> rule like :
> write title error label with the template ServiceErrorTitle_${serviceName}_${attribute},
> if not found resolve the generic ServiceErrorTitle_${serviceName}, if not
> found resolve ServiceErrorTitle_${attribute}
> All service label files would be identify to load in cache at ofbiz start.
> I think it's :
> * easy to develop
> * easy to maintain
> * don't decrease the performance
>
> Opinions ?
>
> Nicolas
>
> --
> logoNrd <https://nereide.fr/>
>         Nicolas Malin
> The apache way <http://theapacheway.com/> : *Openness* Technical
> decisions are made publicly
> information@nereide.fr
> 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/>
>



-- 
Coherent Software Australia Pty Ltd
PO Box 2773
Cheltenham Vic 3192
Australia

Phone: +61 3 9585 6788
Web: http://www.coherentsoftware.com.au/
Email: info@coherentsoftware.com.au