Topic
  • 3 replies
  • Latest Post - ‏2012-06-13T18:41:14Z by Dave Sanders
SystemAdmin
SystemAdmin
76 Posts

Pinned topic how to read list of document class and its subclasses

‏2012-06-12T23:55:16Z |
Hi,
I want to read document class, its subclasses and properties associated with these classes using CMIS REST API or SQL query. Please provide sample URL or SQL query to read the document class and it's properties.

Thanks,
Bhaskara.
Updated on 2012-06-13T18:41:14Z at 2012-06-13T18:41:14Z by Dave Sanders
  • Dave Sanders
    Dave Sanders
    19 Posts

    Re: how to read list of document class and its subclasses

    ‏2012-06-13T03:51:12Z  
    The OpenCMIS Client API Developer's Guide [1] has sample code for retrieving a type definition and its children. Search for getTypeDefinition. An alternative to getDescendants(depth=1) is objectType.getChildren(). A type's property definitions are retrieved via objectType.getPropertyDefinitions. See javadoc [5].

    If you're not using the recommended OpenCMIS (or other Chemistry client API), you can follow URLs. Start with the URL specified by the typebyid URI template [2]. URI templates are in the AtomPub service document. The getTypeDefinition response will have a <atom:link ... rel="down" .../> link which has the URL for getting type children. Add "includePropertyDefinitions=true [3] to the URL query string. A way to find URLs is to use CMIS Workbench [4] with a proxy server such as Fiddler2.

    [1] http://chemistry.apache.org/java/developing/guide.html
    [2] http://docs.oasis-open.org/cmis/CMIS/v1.0/errata-01/os/cmis-spec-v1.0-errata-01-os-complete.html#_Toc243905535
    [3] http://docs.oasis-open.org/cmis/CMIS/v1.0/errata-01/os/cmis-spec-v1.0-errata-01-os-complete.html#_Toc243905438
    [4] http://chemistry.apache.org/java/developing/tools/dev-tools-workbench.html
    [5] http://chemistry.apache.org/java/0.7.0/maven/apidocs/
  • SystemAdmin
    SystemAdmin
    76 Posts

    Re: how to read list of document class and its subclasses

    ‏2012-06-13T07:03:15Z  
    The OpenCMIS Client API Developer's Guide [1] has sample code for retrieving a type definition and its children. Search for getTypeDefinition. An alternative to getDescendants(depth=1) is objectType.getChildren(). A type's property definitions are retrieved via objectType.getPropertyDefinitions. See javadoc [5].

    If you're not using the recommended OpenCMIS (or other Chemistry client API), you can follow URLs. Start with the URL specified by the typebyid URI template [2]. URI templates are in the AtomPub service document. The getTypeDefinition response will have a <atom:link ... rel="down" .../> link which has the URL for getting type children. Add "includePropertyDefinitions=true [3] to the URL query string. A way to find URLs is to use CMIS Workbench [4] with a proxy server such as Fiddler2.

    [1] http://chemistry.apache.org/java/developing/guide.html
    [2] http://docs.oasis-open.org/cmis/CMIS/v1.0/errata-01/os/cmis-spec-v1.0-errata-01-os-complete.html#_Toc243905535
    [3] http://docs.oasis-open.org/cmis/CMIS/v1.0/errata-01/os/cmis-spec-v1.0-errata-01-os-complete.html#_Toc243905438
    [4] http://chemistry.apache.org/java/developing/tools/dev-tools-workbench.html
    [5] http://chemistry.apache.org/java/0.7.0/maven/apidocs/
    Thanks for your reply. I want list of user defined class and its attributes. I have attached the screen shot for your reference.
  • Dave Sanders
    Dave Sanders
    19 Posts

    Re: how to read list of document class and its subclasses

    ‏2012-06-13T18:41:14Z  
    Thanks for your reply. I want list of user defined class and its attributes. I have attached the screen shot for your reference.
    User-defined document classes are subclasses (or deeper) of the cmis:document base class. A CMIS class has attributes (displayName, creatable, etc.) and property definitions [1]. A property definition has attributes (required, cardinality, etc.).
    // get immediate children of the base documen type. Use getTypeDescendants to go deeper
    ItemIterable<ObjectType> subtypes = session.getTypeChildren(EnumBaseObjectTypeIds.CMIS_DOCUMENT.value(), true);
    for (ObjectType type : subtypes) {
    System.out.println("some attributes for type definition whose id=" + type.getId());
    System.out.println("description=" + type.getDescription());
    System.out.println("displayName=" + type.getDisplayName());
    System.out.println("isCreatable" + type.isCreatable());
    for (PropertyDefinition<?> propDef : type.getPropertyDefinitions().values()) {
    System.out.println(" property definition with id=" + propDef.getId());
    System.out.println(" description=" + propDef.getDescription());
    System.out.println(" displayName=" + propDef.getDisplayName());
    System.out.println(" querable=" + propDef.isQueryable());
    System.out.println(" required=" + propDef.isRequired());
    }
    }

    [1] http://docs.oasis-open.org/cmis/CMIS/v1.0/errata-01/os/cmis-spec-v1.0-errata-01-os-complete.html#_Toc243905396