Fetching custom aspect, its properties and its constraints
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2013 05:27 AM
I'm new to alfresco and the webscript development. I have a requirement to fetch customs aspects with its properties and constraints (if any). Is there any possible way to achieve this in JS webscript? I'd like to go with JS on the first hand. If this is not possible with JS, how can we do this in java backed webscript? I've read at some places that Alfresco exposes the aspects which can be accessed using the webscript services, but I found no examples. I tried with JS webscript (which I've a little experience with) but couldn't find a possible way out. I searched a lot but had no luck. Any help is appreciable…Thanks!!
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2013 10:30 AM
How you want to present this is not hugely clear, but in your webscript you need to get a reference to a document and then everything to do with this is "within" that document object.
If you had a document nodeRef in your webscript you could do
If you had a name or path you would need to do a search which would always return an array of document nodeRefs (even if it only returns a single node it will return an array with one element).
Now you can get properties using code like:-
subsituting "cm:name" with your property name.
If you want to check if a document has an aspect you can use
Does this help?
Bob Johnson
If you had a document nodeRef in your webscript you could do
document = search.findNode(noderef);
If you had a name or path you would need to do a search which would always return an array of document nodeRefs (even if it only returns a single node it will return an array with one element).
Now you can get properties using code like:-
var myprop = document.properties["cm:name"];
subsituting "cm:name" with your property name.
If you want to check if a document has an aspect you can use
document.hasAspect("aspectname");
Does this help?
Bob Johnson
