Adding custom models as XML

cancel
Showing results for 
Search instead for 
Did you mean: 
ally311
Member II

Adding custom models as XML

Jump to solution

I'm trying to add a custom model to my alfresco server using an XML model definition file, however every time I try to activate the model it gives the message "could not update details".

I imagine the issue is something to do with how I've written it, but I've based it on the version found on the Jeff Pots tutorial (Working With Custom Content Types in Alfresco | ECMArchitect | Alfresco Developer Tutorials).

The original version outlined in the tutorial works, but my edited version doesn't and I just can't see why.

Any help will be greatly appreciated.

My code is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of new Model -->
<model name="tst:document" xmlns="http://www.alfresco.org/model/dictionary/1.0">
      <!-- Optional meta-data about the model -->
      <description>Test Document Model</description>
      <version>1.0</version>

      <!-- Imports are required to allow references to definitions in other models -->
      <imports>
            <!-- Import Alfresco Dictionary Definitions -->
            <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
            <!-- Import Alfresco Content Domain Model Definitions -->
            <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
      </imports>

      <!-- Introduction of new namespaces defined by this model -->
      <namespaces>
            <namespace uri="http://127.0.0.1:8080/model/testDoc/1.0" prefix="tst" />
      </namespaces>

      <types>
            <!-- Enterprise-wide generic document type -->
            <type name="tst:doc">
            <title>Test Document</title>
            <parent>cm:content</parent>
            </type>
      </types>

      <aspects>
            <aspect name="tst:current">
                  <title>Active Document</title>
                  <properties>
                        <property name="tst:currentVersion">
                              <type>d:boolean</type>
                              <default>true</default>
                              <mandatory>true</mandatory>
                        </property>
                  </properties>
            </aspect>
      </aspects>

</model>

1 Solution

Accepted Solutions
rohit9637
Established Member

Re: Adding custom models as XML

Jump to solution

You have entered the incorrect metamodel sequence for property element. To get information on that visit http://docs.alfresco.com/5.2/concepts/metadata-model-props.html

Replace the code in aspect.

<aspect name="tst:current">
                  <title>Active Document</title>
                  <properties>
                        <property name="tst:currentVersion">
                              <type>d:boolean</type>

                               <mandatory>true</mandatory>
                              <default>true</default>
                         </property>
                  </properties>
            </aspect>

View solution in original post

4 Replies
rohit9637
Established Member

Re: Adding custom models as XML

Jump to solution

You have entered the incorrect metamodel sequence for property element. To get information on that visit http://docs.alfresco.com/5.2/concepts/metadata-model-props.html

Replace the code in aspect.

<aspect name="tst:current">
                  <title>Active Document</title>
                  <properties>
                        <property name="tst:currentVersion">
                              <type>d:boolean</type>

                               <mandatory>true</mandatory>
                              <default>true</default>
                         </property>
                  </properties>
            </aspect>

ally311
Member II

Re: Adding custom models as XML

Jump to solution

thanks, also I can't seem to find the answer, but can you give a type a mandatory aspect that is outlined in the same document? (i.e setting tst:current as mandatory for tst:doc)

rohit9637
Established Member

Re: Adding custom models as XML

Jump to solution

<type name="tst:doc">
            <title>Test Document</title>
            <parent>cm:content</parent>

              <mandatory-aspects>

                  <aspect>tst:current</aspect>

               </mandatory-aspects>


</type>

ally311
Member II

Re: Adding custom models as XML

Jump to solution

thanks, I had tried that, but it seems I'd been using the version with <default> in the wrong place....