AnsweredAssumed Answered

CMIS Secondary type/Aspect creation

Question asked by jimka on Nov 15, 2014
Latest reply on Nov 17, 2014 by mrogers
Hello,

I'm looking to create a secondary type/aspect through Apache Chemistry, using the CMIS 1.1 atom url.

The way I'm currently trying to do this is the following:


TypeDefinition typeDefinition = TypeUtils.readFromXML(Main.class.getResourceAsStream("/example-secondary-type.xml"));
ObjectType createType = session.createType(typeDefinition);


With the xml file having the following content:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<ns3:type xmlns="http://docs.oasis-open.org/ns/cmis/core/200908/"
          xmlns:ns2="http://docs.oasis-open.org/ns/cmis/messaging/200908/"
          xmlns:ns3="http://docs.oasis-open.org/ns/cmis/restatom/200908/"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:type="cmisTypeDocumentDefinitionType">

    <id>test-document</id>
    <localName>test-document</localName>
    <localNamespace>local</localNamespace>
    <displayName>Test document</displayName>
    <queryName>test</queryName>
    <description>Test document.</description>
    <baseId>cmis:secondary</baseId>
    <parentId>cmis:secondary</parentId>
    <createable>false</createable>
    <fileable>false</fileable>
    <queryable>true</queryable>
    <fulltextIndexed>true</fulltextIndexed>
    <includedInSuperTypeQuery>true</includedInSuperTypeQuery>
    <controllablePolicy>false</controllablePolicy>
    <controllableACL>false</controllableACL>
    <versionable>true</versionable>
    <contentStreamAllowed>allowed</contentStreamAllowed>
   
    <propertyStringDefinition>
        <id>test</id>
        <localName>test</localName>
        <localNamespace>local</localNamespace>
        <displayName>Test</displayName>
        <queryName>test</queryName>
        <description>Test</description>
        <propertyType>string</propertyType>
        <cardinalityType>multi</cardinalityType>
        <updatability>readwrite</updatability>
        <inherited>true</inherited>
        <required>false</required>
        <queryable>true</queryable>
        <orderable>false</orderable>
        <openChoice>false</openChoice>
       
        <choice>
            <value>choice1</value>
        </choice>
        <choice>
            <value>choice2</value>
        </choice>
    </propertyStringDefinition>
</ns3:type>


But all I'm getting is the following exception:

Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException: Not supported!
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:477)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.post(AbstractAtomPubService.java:650)
   at org.apache.chemistry.opencmis.client.bindings.spi.atompub.RepositoryServiceImpl.createType(RepositoryServiceImpl.java:250)
   at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.createType(RepositoryServiceImpl.java:192)
   at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createType(SessionImpl.java:819)


What am I missing? And how do I make this work?

ps. I'd would rather not use the alfresco extensions to perform this task since I need to support multiple CMIS 1.1 servers.

Outcomes