cancel
Showing results for 
Search instead for 
Did you mean: 

Custom RESTfull services using CMIS

mastro
Champ in-the-making
Champ in-the-making
Hi,

I need to define a custom model, it will have an UI in Share and I need to expose a read only unauthenticated REST service on my custom types.

I've read the very good guide of Jeff Pott at this link: http://ecmarchitect.com/archives/2012/01/09/1509

It's perfect but I don't know how to use the cmis services from a webscript.

I'm trying to do some proof-of-concept test to see if I'll be able to use alfresco to my needs and I'll appreciate any help Smiley Happy
Currently testing with Alfresco 4.0.c Community

I searched the wiki and this forum but couldn't find the link to an official documentation on how to use the CMIS query service from a controller.

I would like to know how to use it from both a javascript controller and a java-backed controller.

Can you give me reference to the documentation about that? thanks.
2 REPLIES 2

jpotts
World-Class Innovator
World-Class Innovator
Here is an example controller (test.get.js):
var cmisConnection = cmis.getConnection();
var cmisSession    = cmisConnection.getSession();
folder = cmisSession.getRootFolder();
model.folder = folder;
Obviously this isn't too intense. The goal is just to show you how to get the cmis root object. What you do from there is up to you. For example, you could iterate over a folder like this:
var iter = folder.getChildren().iterator();
while (iter.hasNext()) {
  logger.log(iter.next().name);
}
Here is an example descriptor (test.get.desc.xml):
<webscript>
   <shortname>Test CMIS Object</shortname>
   <description>Test CMIS Object</description>
   <url>/someco/testcmis</url>
   <authentication>user</authentication>
</webscript>
And here is an example view (test.get.html.ftl):
<html>
<body>
Folder name:${folder.name}<br />
Folder id:${folder.id}</br />
</body>
</html>
As I mentioned on IRC this morning, the root scoped cmis object appears to be broken in Alfresco 4.0.c Community.

Hope that gets you started.

Jeff

mastro
Champ in-the-making
Champ in-the-making
Thanks Jeff

do I need user authentication to use cmis?
I need to provide a read-only (get only) non-authenticated RESTfull service

Yes I remember you saying it was broken on the .c community release, I'll take it in mind and try with a 3.x community if I have any issue.

Is there a documentation (API) about that cmis javascript object?

thanks