Hello there today i am almost finish with a medium complex EntityProxy
editor module.
But now seems that i found a new hole or don't know why this happens.
This the proxy scenario:
in ProductoProxy i have:
@Valid
public ImpuestoProxy getImpuesto();
@Valid
public ImpuestoProxy getIeps();
whose are @Embedded pojos.
Then on the ImpuestoProxy i have properties that need be validated
differently when it is Impuesto or Ieps so i created a ImpuestoGroup and
ImpuestoIepsTasaGroup marker interfaces to validate differently using the
same Editor (see below why):
@NotNull(message="notNull", groups = {ImpuestoGroup.class,
ImpuestoIepsTasaGroup.class}) /*so be validated when it;s Impuesto or Ieps
*/
@DecimalMin(value="0.0", message="decimalMin:0.0", groups =
{ImpuestoGroup.class, ImpuestoIepsMontoGroup.class})
public Double getTasaImpuesto();
@NotNull(message="notNull", groups = {ImpuestoIepsMontoGroup.class}) /*
so be validated when it's type is Impuesto only */
@DecimalMin(value="0.0", message="decimalMin:0.0", groups =
{ImpuestoIepsMontoGroup.class})
public BigDecimal getMontoImpuesto();
...
Plus i need let user choose predefined valueproxy so i used a:
public class UiOptionalValueListBoxImpl<T, E extends Editor<T>> extends
UiBaseBox implements IsEditor<OptionalFieldEditor<T, E>>{
...
}
So when the user edits a getImpuesto() and then want to save it i check for
constraints in this manner:
driver.flush();
ImpuestoProxy proxy = productoProxy.getIeps();
/* Here i cannot validate the whole ProductoProxy because some
constraints fails due my custom groups.
* so i need validate only the @Embedded proxy
*/
Set constraints = AddProductViewImpl.this.validator.validate(proxy,
proxy.getTipoIeps().equals(TipoIeps.MONTO) ? ImpuestoIepsMontoGroup.class :
ImpuestoIepsTasaGroup.class);
if(!constraints.isEmpty()){
driver.setConstraintViolations(constraints);
}
logger.log(Level.INFO, "After the flush we got
"+driver.getErrors().size());
In my Editor of ImpuestoProxy view i have my own validation ui framework
(user ui messages, etc ...) and to identify a property who us failing i use
their path then i compare with the path reported by List<EditorError>
reported by the main driver.
The problem becomes here. The next behavior happens:
IsEditor<ValueBoxEditor<T>> report path ok
foo.bar.client.view.Products.ImpuestoEditorImpl INFO: On the sub view we
got: ieps.unidadImpuesto notNull
but IsEditor<TakesValueEditor<T>> and IsEditor<LeafValueEditor<T>> don't
foo.bar.client.view.Products.ImpuestoEditorImpl INFO: On the sub view we
got: iepstipoIeps notNull
foo.bar.client.view.Products.ImpuestoEditorImpl INFO: On the sub view we
got: iepsnombreImpuesto notNull
As you can see there is missing . on the path name. ( iepsnombreImpuesto
should be ieps.nombreImpuesto )
Plase note if i validate the whole ProductoProxy the paths are reported
fine
Don't know it the conversion from
driver.setConstraintViolations(constraints); to List<EditorError> fails or
it's the validation who reports badly the path. Will try atm.
Please help me.
Thanks.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/to-czZXXX2YJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.