cancel
Showing results for 
Search instead for 
Did you mean: 

CMIS Secondary type/Aspect creation

jimka
Champ in-the-making
Champ in-the-making
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.
3 REPLIES 3

afaust
Legendary Innovator
Legendary Innovator
Hello,

what you are trying to do is define a completely new aspect (not just use one). According to the <a href="http://docs.oasis-open.org/cmis/CMIS/v1.1/os/CMIS-v1.1-os.html#x1-7400010">CMIS spec</a> this is an optional feature and as far as I know, Alfresco does not support it. You can only define new aspects / types using the standard Alfresco customization paths by bootstrapping model definition files via classpath or the dynamic model registry in /Data Dictionary/Models

Regards
Axel

jimka
Champ in-the-making
Champ in-the-making
That's unfortunate, would you happen to know if Alfresco supports updating an existing secondary type/aspect then?

mrogers
Star Contributor
Star Contributor
Not via CMIS.