I think Brian is planning on issuing an in depth response in a day or two. Thanks for your help!<br><br><div class="gmail_quote">On Thu, Oct 27, 2011 at 10:00, Adrian Gonzalez <span dir="ltr">&lt;<a href="mailto:adr_gonzalez@yahoo.fr">adr_gonzalez@yahoo.fr</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Additionnal thoughts :<br>
<br>
As I understand ViewConfigStore for now, any extension can use ViewConfigStore to store about any metadata (event if it&#39;s limited to Annotation for the moment).<br>
So this is great for additionnal features.<br>
<br>
If we go for solution 4, Page/View will be typed and future extensions will be limited.<br>
We can however add a metadatas field in Page/View for extensions to store about anything in a view.<br>
<br>
IMO, solution 4 would make the code easier to understand (more typed) - but breaks a lot of code, and since I&#39;m a newbie here...<br>
<div class="hm"><br>
<br>
________________________________<br>
De : Adrian Gonzalez &lt;<a href="mailto:adr_gonzalez@yahoo.fr">adr_gonzalez@yahoo.fr</a>&gt;<br>
À : &quot;<a href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a>&quot; &lt;<a href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a>&gt;<br>
Envoyé le : Jeudi 27 Octobre 2011 17h44<br>
Objet : [seam-dev] SEAMFACES-147 viewActions<br>
</div><div><div></div><div class="h5"><br>
Hello,<br>
<br>
I&#39;m working a bit on this issue.<br>
<br>
But I&#39;m stuck now and would like to know the better way to continue (sorry to bother once more ;( ).<br>
<br>
For the moment I&#39;ve :<br>
1. registered all viewActionBindings into the viewConfigStore.<br>
2. more or less replicated SecurityPhaseListener functionnality into a ViewActionPhaseListener.<br>
<br>
But... viewConfigStore can only store Annotations. I need to store AnnotatedMethod (have a link back to the Method I&#39;ll need to call).<br>
<br>
I see 4 possible solutions :<br>
<br>
 1 - Duplicate ViewConfigStoreImpl to store AnnotatedMethod elements.<br>
 Ugly, no ?<br>
 2 - Make ViewConfigStore manage all kind of AnnotatedElements with a wrapper interface like<br>
interface AnnotatedElement&lt;T&gt; {<br>
Annotation&lt;T&gt; annotation;<br>
Object value;<br>
}<br>
ViewConfigStore :<br>
public interface ViewConfigStore {<br>
public abstract void addAnnotationData(String viewId, AnnotatedElement annotation);<br>
public abstract AnnotatedElement&lt;T&gt; T getAnnotationData(String viewId, Class&lt;T&gt; type);<br>
public abstract List&lt;AnnotatedElement&lt;T&gt;&gt; getAllAnnotationData(String viewId, Class&lt;T&gt; type);<br>
public abstract List&lt;AnnotatedElement&gt; getAllQualifierData(String viewId, Class&lt;? extends Annotation&gt; qualifier);<br>
public &lt;T extends Annotation&gt; Map&lt;String, Annotation&gt; getAllAnnotationViewMap(Class&lt;T&gt; type);<br>
}<br>
3 - ViewConfigStore could store Annotated elements instead of Annotations<br>
 This would make ViewConfigStore usage a little more complicated though.<br>
4 - Have somes typed Page or View objects.<br>
 This need really more reflection since we need to know what is a View (security, view actions, ...).<br>
And it&#39;s a big impact on current code.<br>
The ViewConfigStore would be sthing like (really incomplete) :<br>
ViewConfigStore :<br>
public Map&lt;String,ViewInfo&gt; getView(String viewId);<br>
public List&lt;View&gt; getViews();<br>
}<br>
with for instance :<br>
class/interface View {<br>
List&lt;Restriction&gt; getRestrictions();<br>
List&lt;ViewAction&gt; getViewActions(); //or event List&lt;Action&gt; getAction(PhaseId)<br>
}<br>
<br>
WDYT ?<br>
<br>
P.S. Sorry for the rather long mail........<br>
<br>
<br>
More details on what I have done for now :<br>
<br>
As noted in the ticket, I can now create a viewAction annotation like this one :<br>
<br>
<br>
@ViewActionBindingType<br>
@Retention(RetentionPolicy.RUNTIME)<br>
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE})<br>
public @interface MyViewAction {<br>
MyAppViewConfig.Pages value();<br>
}<br>
<br>
MyAppViewConfig being the sample @ViewConfig annotated class in viewconfig sample.<br>
<br>
I can then use MyViewAction like this :<br>
<br>
<br>
@ViewScoped<br>
@Named<br>
public class PageController implements Serializable {<br>
    @MyViewAction(Pages.ITEM)<br>
    public void loadEntry() {<br>
    System.out.println(&quot;loadEntry called&quot;);<br>
    }<br>
}<br>
<br>
For the moment, my code doesn&#39;t call this method (I&#39;ll just need to copy Seam Security code for it ;) ).<br>
<br>
<br>
I&#39;ve also created the following annotation that you can use to annotate your own viewAction annotation :<br>
 - @Condition(condition=String) -&gt; not really type safe.....<br>
 - @Immediate(immediate=Boolean)<br>
 - @OnPostback(onPostback=boolean)<br>
 - @Phase(value=PhaseIdType)<br>
<br>
Also, if you need to customise those behaviour per-usage, you can add attributes into your viewAction annotation :<br>
@MyViewAction(Pages.ITEM, immediate=true, condition=&quot;#{myBean.eager}&quot;)<br>
public void loadEntry()<br>
<br>
_______________________________________________<br>
seam-dev mailing list<br>
<a href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/seam-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/seam-dev</a><br>
<br>
_______________________________________________<br>
seam-dev mailing list<br>
<a href="mailto:seam-dev@lists.jboss.org">seam-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/seam-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/seam-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Jason Porter<br><a href="http://lightguard-jp.blogspot.com" target="_blank">http://lightguard-jp.blogspot.com</a><br><a href="http://twitter.com/lightguardjp" target="_blank">http://twitter.com/lightguardjp</a><br>

<br>Software Engineer<br>Open Source Advocate<br>Author of Seam Catch - Next Generation Java Exception Handling<br><br>PGP key id: 926CCFF5<br>PGP key available at: <a href="http://keyserver.net" target="_blank">keyserver.net</a>, <a href="http://pgp.mit.edu" target="_blank">pgp.mit.edu</a><br>