cancel
Showing results for 
Search instead for 
Did you mean: 

Overriding cm:content

zladuric
Champ on-the-rise
Champ on-the-rise
Hello,

I have a custom content type inheriting cm:content. I also have cm:content indexing set to false, now I want to enable it for this case.

So my custom type (in extended myco-model.xml) looks something like this:

<type name="my:type">
    <title>irrelevant</title>
    <parent>cm:content</parent>
    <properties>
           …
           …
    </properties>
<!– I add my override here: –>
    <overrides>
   <property name="cm:content">
          <type>d:content</type>
     <mandatory>false</mandatory>
     <index enabled="true">
         <atomic>true</atomic>
         <stored>false</stored>
         <tokenised>true</tokenised>
      </index>
   </property>
    </overrides>  
</type>

Now, I get an error at bootstrap:
Caused by: org.jibx.runtime.JiBXException: Expected "{http://www.alfresco.org/model/dictionary/1.0}property" end tag, found "{http://www.alfresco.org/model/dictionary/1.0}type" start tag (line 1422, col 23)
        at org.jibx.runtime.impl.UnmarshallingContext.parsePastCurrentEndTag(UnmarshallingContext.java:800)

Now I checked over and over, the syntax and all it seems fine, I just can't override the content indexing for this type.

Where else could I look?
3 REPLIES 3

piousbox
Champ in-the-making
Champ in-the-making
Do you get the same error when you remove <type>d:content</type> from the overridden property? Seems to me that the type of content should not be overridden…

alcibiade
Champ in-the-making
Champ in-the-making
Removing the type tag will break xml model parsing since it is a mandatory information in a property definition.

electroshokker
Champ on-the-rise
Champ on-the-rise
The model is very strict on *where* you put the overrides.

<code>
<type name="my:type">
    <title>irrelevant</title>
    <parent>cm:content</parent>
<!– overrides need to be directly below the parent –>
    <overrides>
   <property name="cm:content">
          <type>d:content</type>
     <mandatory>false</mandatory>
     <index enabled="true">
         <atomic>true</atomic>
         <stored>false</stored>
         <tokenised>true</tokenised>
      </index>
   </property>
    </overrides>
    <properties>
           …
           …
    </properties> 
</type>
<code>

Also double-check what you are overriding, not everything can be overridden.
This is also discussed in 'https://forums.alfresco.com/forum/developer-discussions/content-modeling/override-cmname-12052013-13...