cancel
Showing results for 
Search instead for 
Did you mean: 

how to get values of a property ?

aznk
Champ in-the-making
Champ in-the-making
Hello,

I've defined a custom aspect which has a tag:tags property:

      
<aspect name="tag:taggable">
         <title>Taggable</title>
         <properties>
            <property name="tag:tags">
               <title>Tags</title>
               <type>d:text</type>
               <multiple>true</multiple>
            </property>
         </properties>
</aspect>

In the node browser, I performed the query "//@tag:tags" with the selectnode, and it returns me all nodes that have this property.
I need to retrieve all values of these nodes, and also tried with the xpath, but it doesn't work :
Search failed due to: java.lang.UnsupportedOperationException
How could we access these values ? I also tried with Lucene but it gave me only the nodes that had the property/aspect.
1 REPLY 1

aznk
Champ in-the-making
Champ in-the-making
Refering to the wiki :
http://wiki.alfresco.com/wiki/Search_Documentation
I saw that we could use the node service (selectnode) with the following example :
// A name space resolver is required - this could be the name space service
DynamicNamespacePrefixResolver namespacePrefixResolver = new DynamicNamespacePrefixResolver(null);
namespacePrefixResolver.addDynamicNamespace(NamespaceService.ALFRESCO_PREFIX, NamespaceService.ALFRESCO_URI);
namespacePrefixResolver.addDynamicNamespace(NamespaceService.ALFRESCO_TEST_PREFIX, NamespaceService.ALFRESCO_TEST_URI);

// Select all nodes below the context node
List<ChildAssocRef> answer =  searchService.selectNodes(rootNodeRef, "*", null, namespacePrefixResolver, false);  
// Find all the property values for @alftest:animal   
List<Serializable> attributes = searchService.selectProperties(rootNodeRef, "//@alftest:animal", null, namespacePrefixResolver, false);
But I don't know where some variables come from : ALFRESCO_TEST_PREFIX and searchService.
I tried to put this code into the SDK but it doesn't work.
Are there any samples on how to use node service that could help me ? I haven't seen the answers to my question in the SDK WebServiceSamples.