AnsweredAssumed Answered

Get current document path by a NodeRef of the version store

Question asked by diegop on May 13, 2009
in order to audit the downloading of a document on a SQL table I modified (Alfresco 2.1 Community Edition).

When I download a document (by clicking on it in the main navigation panels) I don't have any problem to get the full path of the document by the next line code:

// nodeRef is the NodeRef of the document
String parentPath = Repository.getDisplayPath(nodeService.getPath(nodeRef));

Unfortunaley, this line code doesn't work if the user tries to download an OLD version of a versionable document (by opening document details page, expanding the Version panel and clicking on any version listed).

I think that this line code doesn't work because when I click on an OLD version of the document the BaseDownloadContentServlet tries to download a document stored in the version store.

Next, an example of a "working" node ref:

11:54:52,619 DEBUG [] Found NodeRef: workspace://SpacesStore/69fe8aee-3f01-11de-bd7a-b7560ac90ef8

Next, an example of a *NOT WORKING* node ref:

11:53:59,464 DEBUG [] Found NodeRef: versionStore://lightWeightVersionStore/e60658ce-3f07-11de-bcaf-87e078d39305

So…how can I get the "related" NodeRef of the SpaceStore (in order to get successfully its path) by a NodeRef of the lightWeightVersionStore?
Or is there some method to get the path of a document by a NodeRef of the lightWeightVersionStore?


P.S. I tried to use VersionService on the NodeRef of the lightWeightVersionStore but its methods return always null.