cancel
Showing results for 
Search instead for 
Did you mean: 

Access to tags via CMIS?

jswift
Champ in-the-making
Champ in-the-making
We want to know if it's possible to access tags via the CMIS API, ostensibly as Atom categories or CMIS properties? We'd rather not have to use the REST API just to fetch tagging information and CMIS for other things if it can be helped.

Curious.
3 REPLIES 3

jswift
Champ in-the-making
Champ in-the-making
For example…when we get an Atom entry for a document that is "taggable," using the built-in Taggable aspect, we get this back…


<alf:aspects>
   <alf:appliedAspects>P:cm:titled</alf:appliedAspects>
   <alf:appliedAspects>P:cm:taggable</alf:appliedAspects>
   <alf:properties>
      <cmis:propertyString propertyDefinitionId="cm:title" displayName="Title" queryName="cm:title">
         <cmis:value>Test Document</cmis:value>
      </cmis:propertyString>
      <cmis:propertyId propertyDefinitionId="cm:taggable" displayName="Tags" queryName="cm:taggable">
         <cmis:value>Node Type: {http://www.alfresco.org/model/content/1.0}category Node Ref: workspace://SpacesStore/efd2ef99-9a4b-45d4-b776-c79ff9bdcf7b</cmis:value>
         <cmis:value>Node Type: {http://www.alfresco.org/model/content/1.0}category Node Ref: workspace://SpacesStore/9fa79ae0-0139-4be8-917b-81d6efd9175b</cmis:value>
      </cmis:propertyId>
   </alf:properties>      
</alf:aspects>

Ostensibly, I was expecting to see a <cmisSmiley TongueropertyString/> with a <cmis:value/> that contained the actual tag string. However, as you can see, we're getting back "Node Type: …" and "Node Ref: …" values within the <cmis:value/> instead.

Subsequent attempts to fetch those nodes returns a HTTP 500 response caused by a Javascript error…


org.springframework.extensions.webscripts.WebScriptException - 03260007 Wrapped Exception (with status template): 03260062 Error during processing of the template 'Error executing macro: typeuri
required parameter: typedef is not specified.'. Please contact your system administrator.

I'm starting to think that the built-in Taggable aspect isn't much use from a CMIS perspective. Smiley Sad

newhere
Champ in-the-making
Champ in-the-making
I got the same problem. It's not possible to get the Node using his NodeRef and his NodeType?

gclaussn
Champ in-the-making
Champ in-the-making
Its Alfresco-specific. Only thing you could do, is developing a custom solution..

Used the Apache Http Client API (http://hc.apache.org/), when testing a little bit. In this example we receiving a new ticket for authentication.

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;

public class Test {
   public static void main(String[] args) {
      HttpClient client = new HttpClient();
      
      GetMethod method = new GetMethod("http://localhost:8080/alfresco/service/api/login");
      
      NameValuePair[] values = new NameValuePair[2];
      
      values[0] = new NameValuePair("u",  "{username}");
      values[1] = new NameValuePair("pw", "{password}");

       //http://localhost:8080/alfresco/service/api/login?u={username}&pw={login}

       //Same like getting the ticket, when requesting cmis service
       //Result will look so: http://localhost:8080/alfresco/service/api/login
      
      method.setQueryString(values);
      
      try {
         int statusCode = client.executeMethod(method);
         
         if(statusCode != HttpStatus.SC_OK) {
            System.out.println(method.getStatusText());
            return;
         }
         
         System.out.println(method.getResponseBodyAsString(1000));
      } catch(Exception e) {
         e.printStackTrace();
      } finally {
         method.releaseConnection();
      }
   }
}

There are maybe other approaches, but not via CMIS i think.
See http://wiki.alfresco.com/wiki/Repository_RESTful_API_Reference#Package:_.2Forg.2Falfresco.2Freposito... for managing node tags in a RESTful way.

best regards, gclaussn