cancel
Showing results for 
Search instead for 
Did you mean: 

override cm:name

fararjeh
Champ in-the-making
Champ in-the-making
I'm basically trying to override the 'cm:name' property of the cm:content but I keep getting an AlfrescoRuntimeException



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}title" start tag (line 805, col 15)

My custom model


<type name="kaad:departmentPosition">
   <title>Position</title>
   <description>Job position in the department</description>
   <parent>cm:content</parent>
   <properties>
                <property name="kaad:departmentJobType">
           <title>Job Type</title>
                     <type>d:text</type>
            <constraints>
           <constraint ref="kaad:allowedEmployeeJobType" />
            </constraints>   
      </property>
         </properties>
    <overrides>
      <property name="cm:name">
         <title>Name</title>
         <type>d:int</type>
         <mandatory enforced="true">true</mandatory>
         <index enabled="true">
            <atomic>true</atomic>
            <stored>false</stored>
            <tokenised>both</tokenised>
         </index>
         <constraints>
              <constraint ref="cm:filename" />
         </constraints>
      </property>            
   </overrides>          
</type>   

is it possible to override cm:name ?
4 REPLIES 4

rfernandes
Confirmed Champ
Confirmed Champ
I wouldn't try to override the cm:name property specially regarding type of the property. This property has low-level repository meaning and it is for example synchronised by convention with the association name. I would suggest having another custom integer property to control whatever you want to and eventually if required a behaviour to guarantee that cm:name gets updated with the value of the property (but without changing its type).

fararjeh
Champ in-the-making
Champ in-the-making
Thanks for reply .

Suppose I want to change title not type .


<type name="kaad:departmentPosition">
   <title>Position</title>
   <description>Job position in the department</description>
   <parent>cm:content</parent>
   <properties>
                <property name="kaad:departmentJobType">
           <title>Job Type</title>
                     <type>d:text</type>
            <constraints>
           <constraint ref="kaad:allowedEmployeeJobType" />
            </constraints>   
      </property>
         </properties>
    <overrides>
      <property name="cm:name">
         <title>Custom Name</title>
         <type>d:test</type>
         <mandatory enforced="true">true</mandatory>
         <index enabled="true">
            <atomic>true</atomic>
            <stored>false</stored>
            <tokenised>both</tokenised>
         </index>
         <constraints>
              <constraint ref="cm:filename" />
         </constraints>
      </property>            
   </overrides>          
</type>   

Is it possible ??

If you look into modelSchema.xsd (inside alfresco/WEB-INF/classes/alfresco/model) you will see:

<xs:complexType name="propertyOverride">
      <xs:sequence>
         <xs:element name="mandatory" type="xs:boolean"
            maxOccurs="1" minOccurs="0" />
         <xs:element name="default" type="xs:string"
            maxOccurs="1" minOccurs="0" />
         <xs:element name="constraints" maxOccurs="1"
            minOccurs="0">
            <xs:complexType>
               <xs:sequence>
                  <xs:element name="constraint" type="dd:constraint"
                     maxOccurs="unbounded" minOccurs="1" />
               </xs:sequence>
            </xs:complexType>
         </xs:element>
      </xs:sequence>
      <xs:attributeGroup ref="dd:name" />
   </xs:complexType>

So you can´t override title or type. What you can override is the default value, mandatory and constraints. So maybe adding a constraint for a numeric format (REGEX) for the name would be enough for you. With eventual a second custom property of type int that can be bounded by policy to be in synch with the name.

fararjeh
Champ in-the-making
Champ in-the-making
Thanks , Now it's clear to me .