cancel
Showing results for 
Search instead for 
Did you mean: 

Availablity of NodeService in Share (or best way to query for a child node)

rhinmass
Champ in-the-making
Champ in-the-making
I am trying to understand the best way, from a Share webscript, to obtain a specific child node when the parent node and child name is known.

I have tried to use the NodeService, as in http://wiki.alfresco.com/wiki/NodeRef_cookbook , but I am having trouble getting the NodeService injected into my webscript.  Is there a way to use NodeService from share?

The other way I have tried is using the SearchService with a lucene query.  This is sub-opimal because the lucene query returns a fuzzy match.  Therefore to get an exact match I have to cycle through the results pulling out the name and doing a string compare with the target name.

Is this the best way to go about this task?

I am using Alfresco 4.2.c
6 REPLIES 6

mrogers
Star Contributor
Star Contributor
No the node service is not available in share.   There are however lots of webscripts to navigate by path.   Or list children etc.

You shouldn't use search.

rhinmass
Champ in-the-making
Champ in-the-making
Thanks for the tip!  I figured there must be a better way, but haven't been able to figure it out. Can you tell me the name of the webscript or provide an example. 

yogeshpj
Star Contributor
Star Contributor
As such there is no direct webscript for getting child by name from the folder. You need to create your own repository webscript to achieve it.

rhinmass
Champ in-the-making
Champ in-the-making
Yes that is exactly what I'm working on.  But I am having trouble figuring out how to retrieve to a child node within a folder when the parent folder and name are known, without using NodeService or SearchService.

yogeshpj
Star Contributor
Star Contributor
It is not possible without using NodeService. Can you tell me why you dont want to use NodeService ?

kaynezhang
World-Class Innovator
World-Class Innovator
You can use /cmis/query to issue  a CMIS query statement to find a folder node by name.
and then use following api to  get children contained in the specified folder.

  <!– by object id –>
  <url>/cmis/i/{id}/children?types={types?}&amp;filter={filter?}&amp;skipCount={skipCount?}&amp;maxItems={maxItems?}&amp;includeAllowableActions={includeAllowableActions?}&amp;includeRelationships={includeRelationships?}&amp;renditionFilter={renditionFilter?}&amp;orderBy={orderBy?}</url>
  <url>/cmis/s/{store}/i/{id}/children?types={types?}&amp;filter={filter?}&amp;skipCount={skipCount?}&amp;maxItems={maxItems?}&amp;includeAllowableActions={includeAllowableActions?}&amp;includeRelationships={includeRelationships?}&amp;renditionFilter={renditionFilter?}&amp;orderBy={orderBy?}</url>
  <!– by path –>
  <url>/cmis/p{path}/children?types={types?}&amp;filter={filter?}&amp;skipCount={skipCount?}&amp;maxItems={maxItems?}&amp;includeAllowableActions={includeAllowableActions?}&amp;includeRelationships={includeRelationships?}&amp;renditionFilter={renditionFilter?}&amp;orderBy={orderBy?}</url>
  <url>/cmis/s/{store}/p{path}/children?types={types?}&amp;filter={filter?}&amp;skipCount={skipCount?}&amp;maxItems={maxItems?}&amp;includeAllowableActions={includeAllowableActions?}&amp;includeRelationships={includeRelationships?}&amp;renditionFilter={renditionFilter?}&amp;orderBy={orderBy?}</url>
  <!– alfresco style –>
  <url>/api/node/{store_type}/{store_id}/{id}/children?types={types?}&amp;filter={filter?}&amp;skipCount={skipCount?}&amp;maxItems={maxItems?}&amp;includeAllowableActions={includeAllowableActions?}&amp;includeRelationships={includeRelationships?}&amp;renditionFilter={renditionFilter?}&amp;orderBy={orderBy?}</url>
  <url>/api/path/{store_type}/{store_id}/{nodepath}/children?types={types?}&amp;filter={filter?}&amp;skipCount={skipCount?}&amp;maxItems={maxItems?}&amp;includeAllowableActions={includeAllowableActions?}&amp;includeRelationships={includeRelationships?}&amp;renditionFilter={renditionFilter?}&amp;orderBy={orderBy?}</url>