AnsweredAssumed Answered

Custom content model with mandatory aspects.

Question asked by jurahf on May 5, 2017
Latest reply on Jun 29, 2017 by douglascrp

Hello.
I am working with Alfresco Community 201702.

I have created custom content model with xml:

 

<?xml version="1.0" encoding="UTF-8"?>
<model xmlns="http://www.alfresco.org/model/dictionary/1.0" name="lolpu:DocumentTest">
    <description>Document Model for Repo Extension X</description>
    <author>Jura</author>
    <imports>
        <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
        <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
    </imports>
    <namespaces>
        <namespace uri="http://www.lolpu.ru/model/content/1.0" prefix="lolpu"/>
    </namespaces>
    <data-types/>
    <constraints/>
    <types>
        <type name="lolpu:MyDocument">
            <title>Document card</title>
            <parent>cm:content</parent>
            <properties>
                <property name="lolpu:MyNumber">
                    <title>Registration number</title>
                    <type>d:text</type>
                    <mandatory>false</mandatory>
                    <index enabled="true">
                        <tokenised>TRUE</tokenised>
                        <facetable>false</facetable>
                    </index>
                </property>
                <property name="lolpu:MyDate">
                    <title>Registration date</title>
                    <type>d:date</type>
                    <mandatory>false</mandatory>
                    <index enabled="true">
                        <tokenised>TRUE</tokenised>
                    </index>
                </property>
            </properties>
            <associations/>
            <overrides/>
            <mandatory-aspects>
                    <aspect>lolpu:MyComment</aspect>
               </mandatory-aspects>
        </type>
    </types>
    <aspects>
        <aspect name="lolpu:MyComment">
            <title>My comment</title>
            <properties>
                <property name="lolpu:MyCommentText">
                    <title>My comment text</title>
                    <type>d:text</type>
                    <mandatory>true</mandatory>
                    <index enabled="true">
                        <tokenised>TRUE</tokenised>
                        <facetable>false</facetable>
                    </index>
                </property>
            </properties>
            <associations/>
            <overrides/>
            <mandatory-aspects/>
        </aspect>
    </aspects>
</model>

 

I am try to import this model, but get an error:

 

There was a problem importing the file.
Try removing the existing model before importing another.
The custom model doesn't support the 'mandatory-aspects' element.

 

If I delete a line:

40| <aspect>lolpu:MyComment</aspect>

 

, then the import is successful.

 

Does this mean that there is no way to create a custom model with mandatory aspects? What about custom model with associations?

Outcomes