cancel
Showing results for 
Search instead for 
Did you mean: 

Override property of a subtype

livier
Confirmed Champ
Confirmed Champ

Hi every one and happy new year.

I'd like to know if there's a way to override properties in subtypes.

For example, here is my type :

<type name="myCM:entreprise">
            <title>Documents Entreprises</title>
            <parent>myCM:doc</parent>
            <properties>
                <property name=myCM:categories">
                       <title>Categories  </title>
                       <type>d:text</type>
                 </property>

            <properties>   
 </type>

The myCM:entreprise type as the property "categories". In my subtypes, I'd like to override this property with differents lists. I try this code but it doesn't work --> GetModelsDiffs Error :

<type name="myCM:entrepriseAlpha">
            <title>Documents Entreprises</title>
            <parent>myCM:entreprise</parent>
            <overrides>
                <property name="myCM:categories">
                    <title>Categorie de document</title>
                    <type>d:text</type>
                    <constraints>
                        <constraint ref="myCM:listCategoriesAlpha"/>
                    </constraints>
                </property>        
            </overrides>
 </type>

 

<type name="myCM:entrepriseBeta">
            <title>Documents Entreprises</title>
            <parent>myCM:entreprise</parent>
            <overrides>
                <property name="myCM:categories">
                    <title>Categorie de document</title>
                    <type>d:text</type>
                    <constraints>
                        <constraint ref="myCM:listCategoriesBeta"/>
                    </constraints>
                </property>        
            </overrides>
 </type>

Thanks in advance.

I work with SDK 3.0 and alfresco comunity v5.2

1 ACCEPTED ANSWER

afaust
Legendary Innovator
Legendary Innovator

There is a way and the way you went about it looks right. Your main problem is likely the fact that you had already deployed the model without the overrides, and by adding the overrides in a newer version of the model, you have now caused a so call "non-incremental" change of the model. This typically results in issues during model diff as part of the SOLR indexing. Depending on what you have changed, you may simply be fine by reseting all of your SOLR data and reindex. If you already have nodes in the database with one of the sub-types, and your overrides restricted / limited the available set of options, you may have inadvertantly cause some of these nodes to be semantically inconsistent (contain values previously valid but now invalid), which can cause issues during future modifications on these nodes..

View answer in original post

4 REPLIES 4

afaust
Legendary Innovator
Legendary Innovator

There is a way and the way you went about it looks right. Your main problem is likely the fact that you had already deployed the model without the overrides, and by adding the overrides in a newer version of the model, you have now caused a so call "non-incremental" change of the model. This typically results in issues during model diff as part of the SOLR indexing. Depending on what you have changed, you may simply be fine by reseting all of your SOLR data and reindex. If you already have nodes in the database with one of the sub-types, and your overrides restricted / limited the available set of options, you may have inadvertantly cause some of these nodes to be semantically inconsistent (contain values previously valid but now invalid), which can cause issues during future modifications on these nodes..

livier
Confirmed Champ
Confirmed Champ

Hi and thank you very much for your answer.

I'm sorry but I'm totaly new. Could you please  tell me how can I resete all of my SOLR data and reindex ?

Thanks in advance.

livier
Confirmed Champ
Confirmed Champ

up please

douglascrp
World-Class Innovator
World-Class Innovator

Hello.

If by "reset all solr data and index" you meant to perform a full reindex, so this is the documentation you should be reading Performing a full reindex with Solr | Alfresco Documentation