myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Manuel.Gamerdin...@t-systems.com>
Subject AW: @BeanValidation annotation at class level
Date Fri, 19 Oct 2012 15:31:51 GMT
Hi Gerhard,

ProxyUtils.getUnproxiedClass(objectToInspect.getClass()) works fine in my case. But I think
the bug is exactly in this while loop. In this loop always the objectToInspect is passed to
the #transferGroupValidationInformationToFoundGroups. A second iteration will result in same
result as objectToInspect is not changed in the loop. From my point of view the classToInspect
should be passed the #transferGroupValidationInformationToFoundGroups. 

while (!Object.class.getName().equals(classToInspect.getName()))
        {
            transferGroupValidationInformationToFoundGroups(objectToInspect,
                    foundGroupsForPropertyValidation,
                    restrictedGroupsForPropertyValidation,
                    modelValidationEntryList,
                    restrictedGroupsForModelValidation,
                    activeViewId,
                    processModelValidation);

            processInterfaces(objectToInspect.getClass(), objectToInspect,
                    foundGroupsForPropertyValidation,
                    restrictedGroupsForPropertyValidation,
                    modelValidationEntryList,
                    restrictedGroupsForModelValidation,
                    activeViewId,
                    processModelValidation);

            classToInspect = classToInspect.getSuperclass();
        }

Regards,
Manuel

-----Ursprüngliche Nachricht-----
Von: Gerhard Petracek [mailto:gerhard.petracek@gmail.com] 
Gesendet: Freitag, 19. Oktober 2012 17:08
An: MyFaces Discussion
Betreff: Re: @BeanValidation annotation at class level

hi manuel,

ok - i just know that weld changed something in that area.
we tested the DefaultProxyHelper with owb, but maybe websphere uses something special here.

see:
Class classToInspect =
ProxyUtils.getUnproxiedClass(objectToInspect.getClass());
in #processClass

to customize it, you can provide a custom implementation of org.apache.myfaces.extensions.validator.core.proxy.ProxyHelper
(also see e.g. DefaultExtValCoreConfiguration#proxyHelper)

however, you should get the real class in the next iteration (see #getSuperclass in #processClass)
in any case.

regards,
gerhard

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2012/10/19 <Manuel.Gamerdinger@t-systems.com>

> Hi Gerhard,
>
> no, we're using the standard WebSphere 8.0 stack which uses 
> OpenWebBeans 1.1.0.
> Anyways can you give me more information about the ProxyHelper?
>
> Regards,
> Manuel
>
>
> -----Ursprüngliche Nachricht-----
> Von: Gerhard Petracek [mailto:gerhard.petracek@gmail.com]
> Gesendet: Freitag, 19. Oktober 2012 16:01
> An: MyFaces Discussion
> Betreff: Re: @BeanValidation annotation at class level
>
> hi manuel,
>
> i guess - you are using weld...
> you can register a custom ProxyHelper to get rid of the issue.
>
> regards,
> gerhard
>
> http://www.irian.at
>
> Your JSF/JavaEE powerhouse -
> JavaEE Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
>
>
> 2012/10/19 <Manuel.Gamerdinger@t-systems.com>
>
> > Hi Gerhard,
> >
> > I created an issue. My further analysis showed that this is a bug 
> > and not an improvement. The byte code proxy is correct. The 
> > @BeanValidation annotation is not marked as @Inherited and therefore 
> > not populated to its subclasses. But the proxy is a subclass.
> > So for me there are 2 possibilities to correct:
> > 1) Make the Annotation inherited. But I think that would validate 
> > ExtVal's concept of additive groups within a class hierarchy.
> > 2) The suggested solution from my mail before.
> >
> > It would be great if we could get a patch soon!
> > Thanx,
> > Manuel
> >
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Gerhard Petracek [mailto:gerhard.petracek@gmail.com]
> > Gesendet: Freitag, 19. Oktober 2012 13:19
> > An: MyFaces Discussion
> > Betreff: Re: @BeanValidation annotation at class level
> >
> > hi manuel,
> >
> > thx for providing the details.
> > please file a jira ticket (improvement) for it at [1].
> >
> > regards,
> > gerhard
> >
> > [1] https://issues.apache.org/jira/browse/EXTVAL
> >
> > http://www.irian.at
> >
> > Your JSF/JavaEE powerhouse -
> > JavaEE Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
> >
> >
> >
> > 2012/10/19 <Manuel.Gamerdinger@t-systems.com>
> >
> > > Update: It works when I use the @RequestScoped Annotation from 
> > > javax.faces.bean instead of javax.enterprise.context. In that case 
> > > there is no byte code proxy returned (objectToInspect.getClass()).
> > > But anyways I expect that it should also run with the CDI scopes.
> > >
> > > Manuel Gamerdinger
> > >
> > > T-Systems GEI GmbH
> > > Systems Integration
> > > Industry Application Solutions
> > > Project Center Industry Applications Manuel Gamerdinger Software 
> > > Architect Fasanenweg 5, 70771 Leinfelden-Echterdingen
> > > +49 711 999-8704 (Tel.)
> > > +49 160 8224185 (Mobil)
> > > E-Mail: manuel.gamerdinger@t-systems.com
> > > Internet: http://www.t-systems.de
> > >
> > > T-Systems GEI GmbH
> > > Supervisory Board: Dr. Ferri Abolhassan (Chairman) Board of
> > > Management: Hans-Jörg Glaß (Chairman), Jan Krellner Commercial
> > > register: Amtsgericht Aachen HRB 7106 Registered office: Aachen Int.
> > > VAT No. DE 811 137 130
> > >
> > > Notice: This transmittal and/or attachments may be privileged or 
> > > confidential. It is intended solely for the addressee named above.
> > > Any review, dissemination, or copying is strictly prohibited. If 
> > > you received this transmittal in error, please notify us 
> > > immediately by reply and immediately delete this message and all its attachments.
> > > Thank
> > you.
> > >
> > > Big changes start small - conserve resources by not printing every
> > e-mail.
> > >
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Gamerdinger, Manuel
> > > Gesendet: Freitag, 19. Oktober 2012 12:38
> > > An: users@myfaces.apache.org
> > > Betreff: AW: @BeanValidation annotation at class level
> > >
> > > Hi Gerhard,
> > >
> > > thanx for quick response. I tracked down the problem that the 
> > > Annotation
> > > (@BeanValidation) is not available on objectToInspect.getClass() 
> > > in
> > >
> >
> ExtValBeanValidationMetaDataInternals#transferGroupValidationInformationToFoundGroups.
> > >
> > > objectToInspect.getClass() returns a bytecode enhanced proxy class
> > > (...Dlg_$$_javassist_85) where I can see only the @RequestScoped 
> > > Annotation from CDI. Besides @BeanValidation also the @Named 
> > > Annotation from CDI is missing.
> > > I don't know if this behavior of a byte code proxy is correct!? I 
> > > would expect that at least Annotations from Retention CLASS and 
> > > RUNTIME are also available on the proxies.
> > >
> > > I also wonder a little why
> > > ExtValBeanValidationMetaDataInternals#processClass does not use 
> > > the classToInspect (Unproxied Class) to gather the Annotations. If 
> > > this method would pass classToInspect instead of objectToInspect 
> > > to the #transferGroupValidationInformationToFoundGroups everything 
> > > should be
> > fine.
> > >
> > > Any help with this issue is appreciated!
> > > Regards,
> > > Manuel
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Gerhard Petracek [mailto:gerhard.petracek@gmail.com]
> > > Gesendet: Donnerstag, 18. Oktober 2012 21:49
> > > An: MyFaces Discussion
> > > Betreff: Re: @BeanValidation annotation at class level
> > >
> > > hi manuel,
> > >
> > > you can check it in ExtValBeanValidationMetaDataInternals#
> > > extractExtValBeanValidationMetaData
> > > (see #inspectFirstBean (= class level), #inspectFirstProperty, 
> > > #inspectBaseOfProperty (= class level) and #inspectLastProperty)
> > >
> > > regards,
> > > gerhard
> > >
> > > http://www.irian.at
> > >
> > > Your JSF/JavaEE powerhouse -
> > > JavaEE Consulting, Development and Courses in English and German
> > >
> > > Professional Support for Apache MyFaces
> > >
> > >
> > >
> > > 2012/10/18 <Manuel.Gamerdinger@t-systems.com>
> > >
> > > > Hello MyFaces ExtVal users,
> > > >
> > > > I've a question regarding group validation together with 
> > > > @BeanValidation annotation. In my example the @BeanValidation 
> > > > annotation only works on page bean fields. On class level it 
> > > > seems that
> > > the annotation is ignored.
> > > >
> > > > This works:
> > > > @BeanValidation(useGroups=IUiGroupStage2.class)
> > > >     private String wmc;
> > > >
> > > > This doesn't work:
> > > > @BeanValidation(useGroups=IUiGroupStage2.class)
> > > > public class HomeDlg implements Serializable {
> > > >
> > > > The following documentation states that it should be possible to 
> > > > declare the annotation at class level:
> > > > http://wiki.apache.org/myfaces/Extensions/Validator/DevDoc
> > > > But now how can I make it run? Is there some configuration to be
> done?
> > > >
> > > > Thanx in advance!
> > > > Manuel
> > > >
> > > >
> > >
> >
>

Mime
View raw message