cancel
Showing results for 
Search instead for 
Did you mean: 

Way to access node content by secondary path (not primary)

dsnkostic
Champ in-the-making
Champ in-the-making
Hi,

Is there any way to access content of Alfresco node based on secondary path, not primary?
Here is my situation:
I have a folder images where I place my images which are classified under certain sub-folder like:
/images/cars/opel.jpg
/images/bicycles/twocycle.jpg
/images/signs/stop.jpg
etc…
Now i have another folder where I create child-associations to pictures from images folder, like:
/home/order/media/opel.jpg                 points to:/images/cars/open.jpg
/home/order/media/twocycle.jpg            points to:/images/bicycles/twocycle.jpg
/home/order/media/stop.jpg                  points to:/images/signs/stop.jpg

By using this technique I can update original image any time and all associated images will be updated automatically.
Now I am creating some HTML report and I require to display images in that document. I know that I can use NodeRef to get content of images, but, due to specifications, I can't send list of Images NodeRef.
I require something like this:
{$path}/open.jpg
{$path}/twocycle.jpg
{$path}/stop.jpg
where I will simply replace $path with /home/order/media
However I can't find web service that allows fetching of content using secondary path.
For Example: Primary path for opel.jpg is /images/cars/opel.jpg and secondary path is /home/order/media/opel.jpg
There is a CMIS web service 'service/cmis/p/{path}/content' that can get content by primary path only (/images/cars/opel.jpg).
Is there a way to get content by using secondary path that is assigned by adding child association to image (/home/order/media/opel.jpg)?

Thanks in advance!
4 REPLIES 4

andy
Champ on-the-rise
Champ on-the-rise
Hi

I was not aware that CMIS only followed primary associations.

You can always use ….CONTAINS('PATH:"<your path>"')
The PATH is the full Alfresco PATH and not the CMIS path made up of names (it is probably for this reason that CMIS only follows primary associations)

Andy

dsnkostic
Champ in-the-making
Champ in-the-making
Hi Andy,

Thanks for your interest in my problem.
Can you please be more specific how to create such a query? I tried entering some cmis query into Alfresco node-browser:
Store: workspace://SpacesStore
search type: cmis-alfresco,
query: SELECT * FROM cmis:document WHERE CONTAINS('PATH:"/Company Home/CDLView.jpg"').
However, that query produced no results. Into my understanding, CONTAINS keyword searches inside node content. In this particular example it will search for 'PATH:"/Company Home/CDLView.jpg"' string inside any alfresco node.
Am I doing something wrong.

Also I require that content of given node (based on secondary path) be downloadable from Alfresco by using some available web service (if available). I just want an URL to type in my browser and to get content of my node in my browser (to start download or display image for example).

Thank you for your time!

andy
Champ on-the-rise
Champ on-the-rise
Hi

You need the full path not the CMIS name path.
Go to the node browser and look at the paths it reports.
Each step is

<namespaceprefix>:<ISO9075 encoded assoc QName>

The node browser will show you the pattern

Andy

dsnkostic
Champ in-the-making
Champ in-the-making
Hi,

Thank you so much for your hint. I was able now to properly execute query based on path and get node by secondary path.
Query was supposed to be something like this:
SELECT * FROM cmis:document WHERE CONTAINS('PATH:"//app:company_home/cm:CW-Home/cm:CDLView.jpg"')

However I still need web service from Alfresco that returns content based on secondary path. There is a service:
Issue Query (query)
GET /alfresco/service/cmis/query?q={q}&includeAllowableActions={includeAllowableActions?}&includeRelationships={includeRelationships?}&renditionFilter={renditionFilter?}&searchAllVersions={searchAllVersions?}&skipCount={skipCount?}&maxItems={maxItems?}
This service returns results as XML response with reference to node. However, I need service that returns node content not XML response. I might be able to write webscript that mimic behavior that I need, but I was hoping if Alfresco has some out-of-the-box service.

Thanks again. This query will solve some other problems that I had with secondary path, anyway Smiley Happy
Cheers