cancel
Showing results for 
Search instead for 
Did you mean: 

How to have the PATH of a folder with his UUID

lorel
Champ in-the-making
Champ in-the-making
I use a query to have a folder on Alfresco.

I can extract those information :

{http://www.alfresco.org/model/content/1.0}modifier   admin
{http://www.alfresco.org/model/content/1.0}modified   2006-10-26T16:18:53.501+02:00
{http://www.alfresco.org/model/content/1.0}description   On retrouve ici, les informations disponibles en rapport avec l'administration
{http://www.alfresco.org/model/system/1.0}node-uuid   fbf59d48-64d9-11db-94cb-9fa4684f506f
{http://www.alfresco.org/model/content/1.0}creator   admin
{http://www.alfresco.org/model/system/1.0}node-dbid   435
{http://www.alfresco.org/model/system/1.0}store-protocol   workspace
{http://www.alfresco.org/model/content/1.0}title   VisionITGroup Administration
{http://www.alfresco.org/model/content/1.0}name   VisionITGroup Administration
{http://www.alfresco.org/model/system/1.0}store-identifier   SpacesStore
{http://www.alfresco.org/model/content/1.0}created   2006-10-26T12:08:53.562+02:00




In my object architecture, I need to have the path like /app:compagny_home/cm:……

Can you help me please.
12 REPLIES 12

kevinr
Star Contributor
Star Contributor
What API are you using to get the information? The PATH to an object is available using most of the APIs, the NodeService has a getPath() method and the Alfresco JavaScript API and Alfresco FreeMarker Ttemplating API also have methods for retrieving the Path.

Thanks,

Kevin

fchevance
Champ in-the-making
Champ in-the-making
Hi,

I suppose you're using webservices.
So, folderNode is your Node object (org.alfresco.webservice.types.Node)

You can get its path from the Reference object :


Reference nodeRef = folderNode.getReference();
String strPath = nodeRef.getPath();

Fred

lorel
Champ in-the-making
Champ in-the-making
I give you more information

I have the id in parameter

org.alfresco.webservice.types.Node[] tabNode = WebServiceFactory.getRepositoryService().get(new Predicate(new Reference[]{new Reference(Config.getStore(), id, null)}, Config.getStore(), null));
      
      //extraction des informations.
      this.setName(tabNode[0].getProperties(9).getValue());
      this.setTitle(tabNode[0].getProperties(8).getValue());
      this.setDescription(tabNode[0].getProperties(3).getValue());
      this.setId(tabNode[0].getProperties(4).getValue());
      
      this.setRef(tabNode[0].getReference());
      this.setXPath(tabNode[0].getReference().getPath());


I have all information that I want but the ….getPath() return null.

Can you tell me what I have to do?

carina
Champ in-the-making
Champ in-the-making
From what we've observed, there is no way to get a path via web services.  You have to know the path or the uuid before hand to create a Reference or a Query to retrieve objects.  The RepositoryWebService methods return Node objects (either directly or via a ResultSet), but when you call Node.getReference(), the Reference only has the uuid set, not the path.  The Node object also does not contain the child association QName (from which we could create the path manually if we had it).

This is a problem if I want to retrieve a node using get(), browse several levels using getChildren(), and from there conduct a search of all descendents of a particular atribute value.  If I don't know the child association names for the descendents, I have to guess at the path, so my xpath string is not guaranteed to be correct.

It would be great if the Node objects contained the path or child association name in addition to the uuid. 

Please let me know if there is a workaround or if I've missed something.  One possibility is to create a custom action to get the paths for an array of node uuids, but we are trying to limit hits to the server as much as possible.  So hopefully there's a better way.

Thanks for the help.

aurora7795
Champ in-the-making
Champ in-the-making
I wish this functionality was available as well - I'm assuming you guys didn't find any workarounds?

Martin BG

carina
Champ in-the-making
Champ in-the-making
It looks like this issue has been logged (http://issues.alfresco.com/browse/AR-713) and will be fixed soon, which is great!  In the interim, we are manually constructing the paths in our client code.  We are using strict naming/child association conventions for files, folders, and links (which mirror those used by the Alfresco portal), so we can guess at the proper path.  However, in the future, if we add additional types (or additional naming conventions), this won't be as easy, so we will wait for version 1.4E to do that.

pmarreddy
Champ in-the-making
Champ in-the-making
i am looking fo rthe solution too, if somebody found a solution, share it.

thanks prasanth

jtorres
Champ in-the-making
Champ in-the-making
Hope this bug will be solved soon, it'll be really helpful for all  Smiley Sad

If anyone finds a way to get it before the bug is solved please, share it  :wink:

sergio
Champ in-the-making
Champ in-the-making
Hi all.

Just a simple question: where is the org.alfresco.webservice.types.QueryLanguageEnum class? The version of Alfresco (1.4) that I am using does not contain this class, so I cannot use the xpath query language to build queries but only Lucene. Am I correct?

Many thanks to all.