cancel
Showing results for 
Search instead for 
Did you mean: 

Apply a custom action for all space content

redbull
Champ in-the-making
Champ in-the-making
Hi all,
starting from code sample included in Jeff Pott "Alfresco Developer Guide" I have write in Alfresco Explorer (3.2) a custom action that apply to space level and to content level:

         <!– Add action to more actions menu for each space –>
         <!– http://wiki.alfresco.com/wiki/Action_group –>
         <action-group id="space_browse">
            <action idref="setFlag" />
         </action-group>
         <action-group id="document_browse">
            <action idref="setFlag" />
         </action-group>
         <action-group id="document_browse_menu">
            <action idref="setFlag" />
         </action-group>
         <action-group id="doc_details_actions">
            <action idref="setFlag" />
         </action-group>


This action essentially sets a flag (true/false) and it work fine at document level.
My next implementation:
when the user select the action at space level then the custom action should be applied in cycle to its content. So, I need to get the node type and if it is a "Space node" then execute the action to all the content (1 or more file).
Please, can you suggest some code to test node type?
Thanks!
3 REPLIES 3

sujaypillai
Confirmed Champ
Confirmed Champ
Hi,

The method String getType(NodeRef nodeRef) in NodeService API should help you.

Check out more at:http://wiki.alfresco.com/wiki/Node_Service_API_Design


Thanks,

redbull
Champ in-the-making
Champ in-the-making
…I don't know the node name (the one on which I run action), it could be any of my nodes (spaces or content).
How I get NodeRef to pass to getType method?
thanks

redbull
Champ in-the-making
Champ in-the-making
I tried this :

QName nodeType = nodeService.getType(actionedUponNodeRef);   
// nodeType.getLocalName().compareTo("folder") —> it is a space node
// nodeType.getLocalName().compareTo("content") —> it is a content node

It is correct?
Thanks