[Building Sakai] EntityCustomAction problems

Adrian Fish a.fish at lancaster.ac.uk
Wed Jan 20 04:47:42 PST 2010


Hi Stephen,

Thanks for the info. I think I'll just give up on hacking the EB stuff; 
I was hoping to have the basic things like delete and create a room so I 
could demo here, without hassling you. I'm going to package up the 
floating chat code and attach it to the JIRA this afternoon so people 
can kick it about.

Cheers,

Adrian.

Stephen Marquard wrote:
> Here's an example of a VIEW_NEW custom action (calculate):
>
> https://source.sakaiproject.org/contrib/sms/sms/trunk/impl/src/java/org/sakaiproject/sms/entity/SmsTaskEntityProviderImpl.java
>
> For the case below, if you want to create a chat channel, you should rather use the standard REST semantics to create a new entity in the chat-channel provider, rather than a custom action.
>
> Also when you are using EB, there is no tool placement, so this:
>
>          Placement placement = toolManager.getCurrentPlacement();
>
> is not meaningful.
>
> Regards
> Stephen
>
>   
>>>> Adrian Fish <a.fish at lancaster.ac.uk> 2010/01/20 02:29 PM >>>
>>>>         
> Does anybody have a working example of a VIEW_NEW EntityCustomAction 
> that accepts posted data? The code below throws a RuntimeException thus:
>
> WARN Direct request failure: RuntimeException:Fatal error trying to 
> execute custom action method: create:new:create:Direct request failure: 
> RuntimeException:Fatal error trying to execute custom action method: 
> create:new:create:
>
> @EntityCustomAction(action="create",viewKey=EntityView.VIEW_NEW)
>     public boolean create(EntityReference ref, Map<String, Object> params) {
>
>         try
>         {
>         String title = (String) params.get("title");
>         String description = (String) params.get("description");
>
>         LOG.debug("Title: " + title);
>         LOG.debug("Description: " + description);
>
>
>         Placement placement = toolManager.getCurrentPlacement();
>         String siteId = placement.getContext();
>
>         try {
>             
> chatManager.createNewChannel(siteId,title,false,true,placement.getId());
>             return true;
>         } catch(PermissionException pe) {
>             throw new SecurityException("You do not have permission to 
> create channels");
>         } catch(Exception e) {
>             LOG.error("Failed to create channel",e);
>             return false;
>         }
>         }
>         catch(Throwable t)
>         {
>             System.err.println("WHOOPS! ");
>             t.printStackTrace();
>             return false;
>         }
>     }
>
>
> Cheers,
>
> Adrian.
>
>   

-- 
==================================
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/BLOG/Home
http://confluence.sakaiproject.org/display/AGORA/Home

-------------- next part --------------
A non-text attachment was scrubbed...
Name: a_fish.vcf
Type: text/x-vcard
Size: 289 bytes
Desc: not available
Url : http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20100120/0435a64a/attachment.vcf 


More information about the sakai-dev mailing list