Cherry
Cherry

Reputation: 33608

How get alfresco data List name via CMIS?

Here is a code sample:

Folder dataLists = (Folder) session.getObjectByPath("/sites/swsdp/dataLists");
        Joiner joiner = Joiner.on("\t");
        for (Folder cmisObject : (Iterable<Folder>) ((Iterable) dataLists.getChildren())) {
            System.out.println(
                    joiner.join(
                            cmisObject.getId(),
                            cmisObject.getName(),
                            cmisObject.getDescription(),
                            cmisObject.getClass()
                    ));
            System.out.println("==============================");
        }

The output is:

a534356f-8dd6-4d9a-8ffb-dc1adb140c01    71824d77-9cd8-44c3-b3e4-dbca7e17dc49    Project issues  class org.apache.chemistry.opencmis.client.runtime.FolderImpl

Ok, description can be printed via getDescription() method, but how get list name? Why I got an UUID instead of Issue Log? (Issue Log is how list appeared in list of lists).

Upvotes: 0

Views: 463

Answers (1)

Jeff Potts
Jeff Potts

Reputation: 10538

First, you should look at how data lists are structured by navigating to them with the Node Browser. That will shed a lot of light on the structure of the object.

If you do that, you'll learn that the name of a data list is actually stored in the cm:title property. The cm:title property is defined in an aspect, which CMIS calls "secondary types".

If you are using Alfresco 4.2.x or higher and the CMIS 1.1 end point, you should be able to grab the cm:title property using your code using:

cmisObject.getPropertyValue("cm:title")

Also, if you'd rather go the query route, realize that the type you want to query is not cm:folder, but rather dl:dataList. You can do a join with the cm:titled aspect to get the data list title property that way, like this:

SELECT t.cm:title FROM dl:dataList as d join cm:titled as t on d.cmis:objectId = t.cmis:objectId

Upvotes: 1

Related Questions