cancel
Showing results for 
Search instead for 
Did you mean: 

Can't import content model with association between types

IBelyaeva
Champ in-the-making
Champ in-the-making

I use Alfresco Community - 7.2.0 (rf6d005c1-blocal). When I try to import content model with association between types I get the error: "special model does not support element 'associations'". I have created very simple model to test. If tag 'associations' is commented then all is ok. I wonder what's wrong?

<?xml version="1.0" encoding="UTF-8"?>
<!-- xsi:schemaLocation="http://www.alfresco.org/model/dictionary/1.0 modelSchema.xsd" -->
<model name="cm_test:contentmodel_test" 
       xmlns="http://www.alfresco.org/model/dictionary/1.0" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <description>Alfresco Content Domain Model TEST</description>
   <author>Test</author>
   <published>2022-06-29</published>
   <version>1.10</version>

   <imports>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>
   
   <namespaces>
      <namespace uri="http://www.alfresco_test.org/model/content_test/1.10" prefix="cm_test"/>
   </namespaces>
   
   <types>
    <type name="cm_test:authority_test">
        <title>Alfresco Authority Abstract Type</title>
         <parent>sys:base</parent>
     </type>

     <type name="cm_test:zone_test">
         <title>Alfresco Authentication Zone Type</title>
         <parent>cm:cmobject</parent>
         <properties>
         </properties>
         <associations>
            <child-association name="cm_test:inZone_test">
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>cm_test:authority_test</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
               <duplicate>false</duplicate>
            </child-association>
         </associations>
      </type>  
       </types>
       
</model>
4 REPLIES 4

mitpatoliya
Star Collaborator
Star Collaborator

It is because authority_test is created as a child type of sys:base. You normally want to extend cm:content or cm:folder to create new custom content types.

Thank you for your answer. But it looks like the problem is with something else.

I changed types sys:base, cmSmiley Surprisedbject to cm:content, but I have the same error "special model does not support element 'associations'" when try to import the model. New imported model:

<?xml version="1.0" encoding="UTF-8"?>
<!-- xsi:schemaLocation="http://www.alfresco.org/model/dictionary/1.0 modelSchema.xsd" -->
<model name="cm_test:contentmodel_test"
xmlns="http://www.alfresco.org/model/dictionary/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<description>Alfresco Content Domain Model TEST</description>
<author>Test</author>
<published>2022-06-29</published>
<version>1.10</version>

<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
</imports>

<namespaces>
<namespace uri="http://www.alfresco_test.org/model/content_test/1.10" prefix="cm_test"/>
</namespaces>

<types>
<type name="cm_test:authority_test">
<title>Alfresco Authority Abstract Type</title>
<parent>cm:content</parent>
</type>

<type name="cm_test:zone_test">
<title>Alfresco Authentication Zone Type</title>
<parent>cm:content</parent>
<properties>
</properties>
<associations>
<child-association name="cm_test:inZone_test">
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>cm_test:authority_test</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
</child-association>
</associations>
</type>
</types>

</model>

Are there any settings in Alfresco that allow/forbid associations in models?

Given model is working fine. What is the problem?

The problem is:

when I try to import a content model with 'associations' tag (as in xml-file in my previous post) into the Model Manager, I get an error "special model does not support element 'associations'".

If tag 'associations' is commented then model can be imported without errors. 

What's wrong with my Alfresco? Or my permissions?

I do:

1. Log into Alfresco Share as Admin user

2. Select Admin Tools -> Model Manager -> Import Model and select the .zip file to import.

I use Alfresco Community - 7.2.0 (rf6d005c1-blocal).