cancel
Showing results for 
Search instead for 
Did you mean: 

How to get alfresco objest via CMIS

trinhdc
Champ in-the-making
Champ in-the-making
Hello all,
      I have investigated CMIS/alfresco to write out a client app. I have investigated CMIS workbench, dotCmis and many threads/articles.
      After several weeks i get stuck with many confusing. Here are some examples(on Alfresco 5.1 community & one):
       - I can create several types via admin page site, when i upload a file then i change it types and i can select the created types (plus a system type called: Smart Folder Template). But if i used CMIS workbench and invoke Types button then it shows out many types that greater than admin page site. I code out a snip codes and the code also shows out many types, my code is:  foreach (IObjectType oType in Session.GetTypeChildren("cmis:document", true)). My question is how can i get only types same to admin page site?
       - I can not get out Category Root, Tags, aspects… several of them can work but its result puts out more than on admin page site.
       - Generally, how to get all alfresco objects(types, aspect, category, tags)?

Please help me.
Thanks
Regards
2 REPLIES 2

sepgs2004
Star Contributor
Star Contributor
With so many things in Alfresco, for a relatively new developer, it can get complicated easily.
I am tempted to ask why you need to know all the types, aspects, etc. Is it a direct requirement or is it for learning more?
A generic question like this may not get answers at all.


As of now, my Alfresco installation is 5.0.d community edition.
On the Alfresco side, using one of the articles by Jeff Potts (http://ecmarchitect.com/images/Alfresco-Developer-Guide-Chapter-3.pdf), I was able to define a custom type with a custom aspect. This custom aspect has a set of properties. Following the article literally, I have prepared two AMP files, one for the repo tier and the other for the share tier.

On my J2EE application side, I use plain and simple CMIS API, using Apache OpenCmis libraries, in order to communicate with Alfresco repository.
As you see in the CMIS cheat sheet, it has methods to get all the objects, etc.
https://www.alfresco.com/sites/www.alfresco.com/files//cmis-cheatsheet.pdf

Other articles that were useful to me:
http://ecmarchitect.com/alfresco-developer-series
http://ecmarchitect.com/images/articles/cmis/cmis-article.pdf

Good wishes to you
Gnanasekaran Sakthivel

steven_okennedy
Star Contributor
Star Contributor
If I understand your question correctly, you're wondering why (in Share) when you choose to change type on a document you see a small number of types but when you get the list of types back from the CMIS workbench you see a much larger number?

The reason is that Alfresco contains a large number of in-built types for various purposes (some internal, some usable by end users) plus any additional types that you define in custom models.  However, there is configuration in Share to choose what types should be exposed in the Share UI - this limits what's pickable on the screen when changing the type of a document.  When you create a custom model, the model manager also adds your new custom types to this config on the fly, so they appear here too.

CMIS however, does not look at the Share config (it's not aware of Share at all in fact), it goes straight to Alfresco so you don't get a filtered list, you get a complete list of all types defined in the system.

Unfortunately, because CMIS doesn't take into account Share config, you can't easily restrict the list of types to only the ones shown in Share.  There's also nothing different (queryable) about the custom types you create using the Share admin screens, so you can't even use a different CMIS query to select them, unless you hardcode the types you want to get back/exclude or use a naming convention etc, unfortunately.

Same will be true for aspects - the UI configuration filters what Share shows you, so CMIS is giving you a complete list so you'll see more than what's in Share.

Regards

Steven