java-backed webscript get properties of node by workspace
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2013 09:22 AM
i have workspace: workspace://SpacesStore/e0776399-35a8-4b22-be03-7109a3086865
i want to get Properties of node with this workspace
please help me code demo
i want to get Properties of node with this workspace
please help me code demo
Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2013 10:51 AM
Hi,
could you express your requirements more clearly?
What are you trying to do? And please tell us about your Alfresco configuration.
Regards,
Andrea
could you express your requirements more clearly?
What are you trying to do? And please tell us about your Alfresco configuration.
Regards,
Andrea
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2013 11:40 AM
You'll want to use the <a href="http://dev.alfresco.com/resource/docs/java/datamodel/org/alfresco/service/cmr/repository/NodeService...">NodeService</a> for most of this. Your code would be something like:
That'll give you all the properties on the node, indexed by their QName.
// Make sure our node exists NodeRef nodeRef = new NodeRef("workspace://SpacesStore/e0776399-35a8-4b22-be03-7109a3086865"); if (! nodeService.exists(nodeRef)) { throw new AlfrescoRuntimeException("Sorry, " + nodeRef + " doesn't exist"); } // Fetch all the properties Map<QName, Serializable> props = nodeService.getProperties(nodeRef); // Fetch a few common properties String name = (String)props.get(ContentModel.PROP_NAME; String title = (String)props.get(ContentModel.PROP_TITLE);
That'll give you all the properties on the node, indexed by their QName.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2014 03:08 AM
Hi,
Where should I input this code snippet? At the alfresco explorer?
Regards,
JP
Where should I input this code snippet? At the alfresco explorer?
Regards,
JP
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2013 02:24 PM
xmlxml,
I know a Java solution was requested but for anyone reading, in case a Javascript solution is preferred, you can try the following:
Cheers,
I know a Java solution was requested but for anyone reading, in case a Javascript solution is preferred, you can try the following:
var node = utils.getNodeFromString("workspace://SpacesStore/e0776399-35a8-4b22-be03-7109a3086865");var name = node.properties["cm:name"]);var title = node.properties["cm:title"]);
Cheers,

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2013 01:02 AM
How to inject nodeService or get reference to nodeService in my current development project ?
The thing is that i want the node's any properties by it's name.
is there any api available for the same ?
The thing is that i want the node's any properties by it's name.
is there any api available for the same ?
