AnsweredAssumed Answered

Adding mandatory aspects to a custom type

Question asked by doggrant on Jun 29, 2018

Hi,

 

In alfresco community edition I'm trying to add a mandatory aspect to a custom type in a custom model and when i try to import the model via the model manager I get the following error message:

 

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.

 

The company.xml file for the model is as follows:

 

<?xml version="1.0" encoding="UTF-8"?>
<model xmlns="http://www.alfresco.org/model/dictionary/1.0" name="acu:company">
    <description>This is a custom model for company specific documents</description>
    <author>David Grant</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://company.com/model/company" prefix="acu"/>
    </namespaces>
    <data-types/>
    <constraints/>
    <types>
        <type name="acu:versionable-quality-document">
            <description>An company Quality document that contains it's own version information</description>
            <parent>cm:content</parent>
            <properties/>
            <associations/>
            <overrides/>
            <mandatory-aspects>
                    <aspect>acu:quality-document</aspect>
               </mandatory-aspects>
        </type>
    </types>
    <aspects>
        <aspect name="acu:quality-document">
            <title>quality document</title>
            <description>Properties for a version controlled quality documents.</description>
            <properties>
                <property name="acu:revision-summary">
                    <title>Summary</title>
                    <description>The summary text from the front page of the quality document's history table</description>
                    <type>d:text</type>
                    <mandatory>true</mandatory>
                    <index enabled="true">
                        <tokenised>TRUE</tokenised>
                        <facetable>false</facetable>
                    </index>
                </property>
                <property name="acu:revision">
                    <title>Revision</title>
                    <description>The quality document revision as displayed on the front page of the document

Must be in the format a.b.c, where 'a' and 'b' are mandatory.</description>
                    <type>d:text</type>
                    <mandatory>true</mandatory>
                    <index enabled="false">
                        <tokenised>TRUE</tokenised>
                    </index>
                    <constraints>
                        <constraint name="acu:REGEX_6f6dd062-f9d7-4cbd-81bb-eccbe36e2dac" type="REGEX">
                            <parameter name="requiresMatch">
                                <value>true</value>
                            </parameter>
                            <parameter name="expression">
                                <value>^(\d{1,3}[.]){1,2}(\d{1,3})?$</value>
                            </parameter>
                        </constraint>
                    </constraints>
                </property>
                <property name="acu:originator">
                    <title>Updated By</title>
                    <description>The initials of the person who performed the revision update</description>
                    <type>d:text</type>
                    <mandatory>true</mandatory>
                    <index enabled="true">
                        <tokenised>TRUE</tokenised>
                        <facetable>false</facetable>
                    </index>
                </property>
                <property name="acu:date-last-updated">
                    <title>Last updated</title>
                    <description>This is the date on which the revision was updated</description>
                    <type>d:date</type>
                    <mandatory>true</mandatory>
                    <index enabled="true">
                        <tokenised>TRUE</tokenised>
                    </index>
                </property>
            </properties>
            <associations/>
            <overrides/>
        </aspect>
    </aspects>
</model

 

If I comment out line 22

 

<mandatory-aspects>
   <!-- <aspect>acu:quality-document</aspect> -->
</mandatory-aspects>

 

Then the import works correctly.

 

I have attached the full company.zip for the model.  

 

Are <mandatory-aspects> allowed in a custom type within a model.  It would seem so from the xml, as an empty <mandatory-aspects/> tag is there by default.

 

However, as stated, adding an aspect to the <mandatory-aspects> tag causes the error above.

Attachments

Outcomes