Book Image

Alfresco CMIS

By : Martin Bergljung
Book Image

Alfresco CMIS

By: Martin Bergljung

Overview of this book

Table of Contents (14 chapters)
Alfresco CMIS
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Listing available types and subtypes


Getting to know the content model that the CMS server supports is important so that we can classify objects according to the specific domain we are in. The OpenCMIS API provides methods to list types and their subtypes.

Add the following code to the CmisClient class:

public void listTypesAndSubtypes(Session session) {
  boolean includePropertyDefinitions = false;
  List<Tree<ObjectType>> typeTrees = 
    session.getTypeDescendants(
    null, -1, includePropertyDefinitions);
  for (Tree<ObjectType> typeTree : typeTrees) {
    logTypes(typeTree, "");
  }
}

The preceding listTypesAndSubtypes method uses the getTypeDescendants method on the session object to get the type hierarchy that has been deployed to the server. The getTypeDescendants method takes three parameters: the first one specifies if we should start at the top of the tree or not; null indicates that we should start from the top. On the other hand, if we wanted to only list the...