[Building Sakai] Wicket and entity broker

Steve Swinsburg steve.swinsburg at gmail.com
Wed Jan 12 13:41:28 PST 2011


Hi Tania,

Could you use a normal form, not a wicket form, then redirect back to a page in the application? I'm not sure how that would work in the Sakai portal framework though since it's not just pages you are going to. Alternatively, submit it via a jQuery ajax request and then you can get back the status code.

Who will be deploying the provider? Could you use a proxy bean which delegates to the appropriate method and runs the logic only if it's setup? This is what happens with a few services already so you can overload them with different implementations but the method call is always the same, it may or may not do anything. Then you can just do the logic inside the Wicket form and know that it will be safe.

cheers,
Steve




On 12/01/2011, at 7:29 PM, Tania Tritean wrote:

>  
> Thanks for the reply.
>  
> What I want to achieve is this:
>  
> I have a tool, where I have a button “doX”. I want to create a provider with a custom action X that will be called when I click “doX”. If the provider with that action is not deployed in sakai nothing will happen.
>  
> I can get this in 2 ways(from what I know):
> 1. Create a new capability, an interface that my tool will have to know,
> And then call something like this:
> XCapability  capability = entityProviderManager.getProviderByPrefixAndCapability(“myprefix”,XCapability.class)
> If(capability != null {)
> Try {
> capability.x
> } catch exception{ …. Redirect to same pages depending of exceptions}
> }
>  
> What I don’t like at this is that I need that interface XCapability.
> 2. use EntityCustomAction that will make the x to be used like a  restservice
> With this I  won’t need the interface anymore, just to know the url.
> But I don’t know how to call the url from wicket and analize the response
>  
>  
> Is there another way to do this, a better way?
> Or how can I implement point 2?
>  
> Thanks
>  
> Tania
>  
>  
>  
> From: Steve Swinsburg [mailto:steve.swinsburg at gmail.com] 
> Sent: Tuesday, January 11, 2011 11:33 PM
> To: Tania Tritean
> Cc: sakai-dev at collab.sakaiproject.org
> Subject: Re: [Building Sakai] Wicket and entity broker
>  
> Hi Tania,
>  
> The EntityCustomAction would call some piece of logic, so why not use Wicket's built in form processing and call the same logic? If you could expand a bit on what you are trying to achieve, we can come up with a solution.
>  
> cheers,
> Steve
>  
> --------------------------------------------------------------
>  
> The only way I've done that is to just get the HTTP return code and message via the XmlHttpRequest object in JS. I would then render different html based on the response. If you wanted to do it that way in java you'd have to use HttpConnection or something.
> 
> Alternatively you could do a filthy hack like pulling the entity provider from the component manager and look up the custom action method using reflection. Call it, trap the appropriate exception and redirect. Ughhh.
> 
> Most of my coding is done in JS on the client nowadays, so I'm out of touch with the Wicket stuff.
> 
> Cheers,
> 
> Adrian.
>  
>  
> On 12/01/2011, at 3:26 AM, Tania Tritean wrote:
> 
> 
> Thanks for the answer.
>  
> The thing is that the action can throw different exception and I have to redirect to different pages depending on the exception.
> How can I do this?
>  
> Thanks,
> Tania
>  
>  
> From: sakai-dev-bounces at collab.sakaiproject.org [mailto:sakai-dev-bounces at collab.sakaiproject.org] On Behalf Of Adrian Fish
> Sent: Tuesday, January 11, 2011 1:38 PM
> To: sakai-dev at collab.sakaiproject.org
> Subject: Re: [Building Sakai] Wicket and entity broker
>  
> Correction, the EB url would be more like /direct/my-service/my-entity/my-action. Here's a real one from the floating chat:
> 
> /direct/sfc-message/803ec9d8-6798-402d-9702-13b201627e54/online.json
> 
> Just to avoid confusion ...
> 
> On 11/01/2011 12:29, Adrian Fish wrote:
> Hi Tania,
> 
> If you set the action attribute of the form to the EB url (eg: /direct/my-service/my-action) it should send the parameters through to the Map<String,Object> params argument in the custom action method. In other words Wicket's form handling isn't involved at all.
> 
> Does the custom action return anything other than a success code?
> 
> Cheers,
> Adrian.  
> 
> On 11/01/2011 11:57, Tania Tritean wrote:
> Hello,
>  
> I need to call a EntityCustomAction from a wicket tool. Can anybody please tell me how can I do that?
>  
> In the tool I have a page, on the submit button of the form from that page I want to call the method annotated with EntityCustomAction.
> The method can throw different exceptions that I need to handle in UI.
>  Is there a ‘rest client’ in sakai that I can use for this with wicket?
>  
> Thanks in advance,
>  
> Tania
>  
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>  
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
> 
> 
> 
> -- 
> ==================================
> Adrian Fish
> Software Engineer
> Centre for e-Science
> Bowland Tower South C Floor
> Lancaster University
> Lancaster
> LA1 4YW
> email: a.fish at lancaster.ac.uk
>  
> http://confluence.sakaiproject.org/display/YAFT/Yaft
> http://confluence.sakaiproject.org/display/CLOG/Home
> http://confluence.sakaiproject.org/display/BBB/Home
>  
>  
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>  
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
> 
> 
> 
> -- 
> ==================================
> Adrian Fish
> Software Engineer
> Centre for e-Science
> Bowland Tower South C Floor
> Lancaster University
> Lancaster
> LA1 4YW
> email: a.fish at lancaster.ac.uk
>  
> http://confluence.sakaiproject.org/display/YAFT/Yaft
> http://confluence.sakaiproject.org/display/CLOG/Home
> http://confluence.sakaiproject.org/display/BBB/Home
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
> 
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
>  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20110113/4d9e42a2/attachment.html 


More information about the sakai-dev mailing list