cancel
Showing results for 
Search instead for 
Did you mean: 

overriding properties simply does not work

sbixsbix
Champ in-the-making
Champ in-the-making
Hi,
I have opened several threads because I was trying to override the cm:description property.
Then I decided to leave description as it is and to override some properties of my content not inherited by cm:content.
This is the relevant portion of contentmodel.xml file:
        <type name="acme:acmeCommon">
           <title> Modello base CM acme</title>
           <parent>cm:content</parent>
           <properties>
                 <property name="acme:XXX1">
                   <title>Variable field 1</title>
                   <type>d:text</type>
                   <mandatory>false</mandatory>
                </property>
                <property name="acme:FilingDate">
                   <title>Data Inserimento Doc</title>
                   <type>d:date</type>
                   <mandatory>true</mandatory>
                   <index enabled="true">
                        <atomic>true</atomic>
                        <stored>false</stored>
                        <tokenised>false</tokenised>
                   </index>
                </property>
                <property name="acme:FilingOffice">
                   <title>Ufficio caricatore</title>
                   <type>d:text</type>
                   <mandatory>true</mandatory>
                   <default>Ufficio X</default>
                </property>
                <property name="acme:InnerRefNo">
                   <title>Protocollo ACS</title>
                   <type>d:text</type>
                   <mandatory>true</mandatory>
                   <index enabled="true">
                        <atomic>true</atomic>
                        <stored>false</stored>
                        <tokenised>false</tokenised>
                   </index>
                   <constraints>
                        <constraint ref="acme:ReferenceNO"/>
                   </constraints>
                </property>
                <property name="acmeSmiley SurpriseduterRefNo">
                   <title>Protocollo Esterno</title>
                   <type>d:text</type>
                   <mandatory>true</mandatory>
                   <default>Non Specif</default>
                   <index enabled="true">
                        <atomic>true</atomic>
                        <stored>false</stored>
                        <tokenised>false</tokenised>
                   </index>
                </property>
               <property name="acmeSmiley Very HappyocDate">
                   <title>Data Documento</title>
                   <type>d:date</type>
                   <mandatory>true</mandatory>
                   <index enabled="true">
                        <atomic>true</atomic>
                        <stored>false</stored>
                        <tokenised>false</tokenised>
                   </index>
                </property>
           </properties>
        </type>
        <type name="acme:Assets">
           <title>Modello Comune Assets acme</title>
           <parent>acme:acmeCommon</parent>
           <properties>
                <property name="DocSubType">
                   <title>Doc Sub Type</title>
                   <type>d:text</type>
                   <mandatory>true</mandatory>
                   <index enabled="true">
                        <atomic>true</atomic>
                        <stored>false</stored>
                        <tokenised>false</tokenised>
                   </index>
                </property>
                <property name="acme:acmeBranch">
                   <title>Casa acmea</title>
                   <type>d:text</type>
                   <mandatory>true</mandatory>
                   <index enabled="true">
                        <atomic>true</atomic>
                        <stored>false</stored>
                        <tokenised>false</tokenised>
                   </index>
                   <constraints>
                        <constraint ref="acme:acmeBranches" />
                   </constraints>
                </property>
                <property name="acme:LegalEntity">
                   <title>Ente Giuridico</title>
                   <type>d:text</type>
                   <mandatory>true</mandatory>
                </property>
                <property name="acme:CounterPart">
                   <title>Controparte</title>
                   <type>d:text</type>
                   <mandatory>true</mandatory>
                </property>
                <property name="acme:AssetValue">
                   <title>Valore</title>
                   <type>d:float</type>
                   <mandatory>false</mandatory>

                </property>
                <property name="acme:Currency">
                   <title>Valuta</title>
                   <type>d:text</type>
                   <mandatory>false</mandatory>
                   <constraints>
                        <constraint ref="acme:Currencies"/>
                   </constraints>
                </property>
           </properties>
        </type>
        <type name="acme:AcqDocs">
           <title>Acquisizione Immobili</title>
           <parent>acme:Assets</parent>
           <overrides>
                <property name="acme:XXX1">
                   <title>XXXXXX</title>
                   <mandatory>true</mandatory>
                   <constraints>
                        <constraint type="LIST">
                           <parameter name="allowedValues">
                                <list>
                                   <value>a1</value>
                                   <value>a2</value>
                                   <value>a3</value>
                                </list>
                           </parameter>
                        </constraint>
                   </constraints>
      <property/>
   </overrides>
   </type>

But when I stop & start Alfresco I got always the same error:
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 2187, col 13)
        at org.jibx.runtime.impl.UnmarshallingContext.parsePastCurrentEndTag(UnmarshallingContext.java:731)
        at org.alfresco.repo.dictionary.JiBX_defaultMungeAdapter.JiBX_default_unmarshal_1_12()
        at org.alfresco.repo.dictionary.M2Class.JiBX_default_unmarshal_1_0(M2Class.java)
        at org.alfresco.repo.dictionary.M2Type.JiBX_default_unmarshal_2_0(M2Type.java)
        at org.alfresco.repo.dictionary.JiBX_defaultM2Type_access.unmarshal()
        at org.alfresco.repo.dictionary.JiBX_defaultMungeAdapter.JiBX_default_unmarshal_1_4()
        at org.alfresco.repo.dictionary.M2Model.JiBX_default_unmarshal_1_0(M2Model.java)
        at org.alfresco.repo.dictionary.JiBX_defaultM2Model_access.unmarshal()
        at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2757)
        at org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2900)
        at org.alfresco.repo.dictionary.M2Model.createModel(M2Model.java:97)
        … 37 more

Are there someone who can say which is the correct syntax for overriding properties?
8 REPLIES 8

mitpatoliya
Star Collaborator
Star Collaborator
That is because your model is not defined properly.You are not following the schema properly.
Constrains should be defined out side the type tag
Refer the out of box content model file for proper syntex and schema.


sbixsbix
Champ in-the-making
Champ in-the-making
Mits,
I tried also to put the constraints out of the <type name="acme:blah"> blah blah </type> block, but it still does not work.
This is the complete model with thew constraints taken out:
<?xml version="1.0" encoding="UTF-8"?>

<!– ACME Content Model –>

<!– Note: This model is pre-configured to load at startup of the Repository.  So, all custom –>
<!–       types and aspects added here will automatically be registered –>

<model name="acme:myContentModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>
   <description>ACME Content Model - based upon J.Potts example work SomeCo Model</description>
   <author>Francesco Sordi</author>
   <version>1.0</version>

   <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 –>
   <!– NOTE: The following namespace custom.model should be changed to reflect your own namespace –>
   <namespaces>
      <namespace uri="acme.myContentModel" prefix="acme"/>
   </namespaces>

   <constraints>
        <!– Global Constraints  –>
        <constraint name="acme:InnerRefSys" type="REGEX">
           <parameter name="expression"><value>[0-3][0-9]/[0-9]{4}</value></parameter>
           <parameter name="requiresMatch"><value>true</value></parameter>
        </constraint>
        <constraint name="acme:Currencies" type="LIST">
           <parameter name="allowedValues">
                <list>
                   <value>AUD</value>
                   <value>GBP</value>
                   <value>EUR</value>
                   <value>JPY</value>
                   <value>CHF</value>
                   <value>USD</value>
                   <value>AFN</value>
                   <value>ALL</value>
                   <value>DZD</value>
                   <value>AOA</value>
                   <value>ARS</value>
                   <value>AMD</value>
                   <value>AWG</value>
                   <value>AUD</value>
                   <value>AZN</value>
                   <value>BSD</value>
                   <value>BHD</value>
                   <value>BDT</value>
                   <value>BBD</value>
                   <value>BYR</value>
                   <value>BZD</value>
                   <value>BMD</value>
                   <value>BTN</value>
                   <value>BOB</value>
                   <value>BAM</value>
                   <value>BWP</value>
                   <value>BRL</value>
                   <value>GBP</value>
                   <value>BND</value>
                   <value>BGN</value>
                   <value>BIF</value>
                   <value>XOF</value>
                   <value>XAF</value>
                   <value>XPF</value>
                   <value>KHR</value>
                   <value>CAD</value>
                   <value>CVE</value>
                   <value>KYD</value>
                   <value>CLP</value>
                   <value>CNY</value>
                   <value>COP</value>
                   <value>KMF</value>
                   <value>CDF</value>
                   <value>CRC</value>
                   <value>HRK</value>
                   <value>CUC</value>
                   <value>CUP</value>
                   <value>CYP</value>
                   <value>CZK</value>
                   <value>DKK</value>
                   <value>DJF</value>
                   <value>DOP</value>
                   <value>XCD</value>
                   <value>EGP</value>
                   <value>SVC</value>
                   <value>EEK</value>
                   <value>ETB</value>
                   <value>EUR</value>
                   <value>FKP</value>
                   <value>FJD</value>
                   <value>GMD</value>
                   <value>GEL</value>
                   <value>GHS</value>
                   <value>GIP</value>
                   <value>GTQ</value>
                   <value>GNF</value>
                   <value>GYD</value>
                   <value>HTG</value>
                   <value>HNL</value>
                   <value>HKD</value>
                   <value>HUF</value>
                   <value>ISK</value>
                   <value>INR</value>
                   <value>IDR</value>
                   <value>IRR</value>
                   <value>IQD</value>
                   <value>ILS</value>
                   <value>JMD</value>
                   <value>JPY</value>
                   <value>JOD</value>
                   <value>KZT</value>
                   <value>KES</value>
                   <value>KWD</value>
                   <value>KGS</value>
                   <value>LAK</value>
                   <value>LVL</value>
                   <value>LBP</value>
                   <value>LSL</value>
                   <value>LRD</value>
                   <value>LYD</value>
                   <value>LTL</value>
                   <value>MOP</value>
                   <value>MKD</value>
                   <value>MGA</value>
                   <value>MWK</value>
                   <value>MYR</value>
                   <value>MVR</value>
                   <value>MTL</value>
                   <value>MRO</value>
                   <value>MUR</value>
                   <value>MXN</value>
                   <value>MDL</value>
                   <value>MNT</value>
                   <value>MAD</value>
                   <value>MZN</value>
                   <value>MMK</value>
                   <value>ANG</value>
                   <value>NAD</value>
                   <value>NPR</value>
                   <value>NZD</value>
                   <value>NIO</value>
                   <value>NGN</value>
                   <value>KPW</value>
                   <value>NOK</value>
                   <value>OMR</value>
                   <value>PKR</value>
                   <value>PAB</value>
                   <value>PGK</value>
                   <value>PYG</value>
                   <value>PEN</value>
                   <value>PHP</value>
                   <value>PLN</value>
                   <value>QAR</value>
                   <value>RON</value>
                   <value>RUB</value>
                   <value>RWF</value>
                   <value>WST</value>
                   <value>STD</value>
                   <value>SAR</value>
                   <value>RSD</value>
                   <value>SCR</value>
                   <value>SLL</value>
                   <value>SGD</value>
                   <value>SKK</value>
                   <value>SIT</value>
                   <value>SBD</value>
                   <value>SOS</value>
                   <value>ZAR</value>
                   <value>KRW</value>
                   <value>LKR</value>
                   <value>SHP</value>
                   <value>SDG</value>
                   <value>SRD</value>
                   <value>SZL</value>
                   <value>SEK</value>
                   <value>CHF</value>
                   <value>SYP</value>
                   <value>TWD</value>
                   <value>TZS</value>
                   <value>THB</value>
                   <value>TOP</value>
                   <value>TTD</value>
                   <value>TND</value>
                   <value>TRY</value>
                   <value>TMM</value>
                   <value>USD</value>
                   <value>UGX</value>
                   <value>UAH</value>
                   <value>UYU</value>
                   <value>AED</value>
                   <value>VUV</value>
                   <value>VEB</value>
                   <value>VND</value>
                   <value>YER</value>
                   <value>ZMK</value>
                   <value>ZWD</value>
                </list>
           </parameter>
        </constraint>
        <constraint name="acme:ACMEBranches" type="LIST">
           <parameter name="allowedValues">
                <list>
                <value>AET-001</value>
                <value>AET-002</value>
                <value>AET-003</value>
                <value>AET-004</value>
                <value>AET-005</value>
                <value>AFE-001</value>
                <value>AFE-002</value>
                <value>AFE-003</value>
                <value>AFE-004</value>
                <value>AGL-001</value>
                <value>AGL-002</value>
                <value>AGL-003</value>
                <value>AGL-004</value>
                <value>AGL-005</value>
                <value>AGL-006</value>
                <value>AGL-007</value>
                <value>BOL-001</value>
                <value>BOL-002</value>
                <value>BOL-003</value>
           </list>
        </parameter>
        </constraint>

        <constraint name="acme:AcqwWays" type="LIST" >
           <parameter name="allowedValues">
                <list>
                     <value>buying</value>
                     <value>gift</value>
                     <value>other</value>
                </list>
           </parameter>
        </constraint>

        <constraint name="acmeSmiley Very HappyisWays" type="LIST" >
           <parameter name="allowedValues">
                <list>
                     <value>selling</value>
                     <value>gift</value>
                     <value>other</value>
                </list>
           </parameter>
        </constraint>

        <constraint name="acme:NonRealtyAssetsWays" type="LIST" >
           <parameter name="allowedValues">
                <list>
                     <value>legacy</value>
                     <value>gift</value>
                     <value>other</value>
                </list>
           </parameter>
        </constraint>

        <constraint name="acme:RealtyDocTypes" type="LIST" >
           <parameter name="allowedValues">
                <list>
                    <value>purchase agreement</value>
                    <value>deed</value>
                    <value>other notary file</value>
                    <value>map</value>
          <value>planimetry</value>
                    <value>realty photo/video</value>
                </list>
           </parameter>
        </constraint>

        <constraint name="acme:WrkDocTypes" type="LIST" >
           <parameter name="allowedValues">
                <list>
                     <value>estimate</value>
                     <value>invoice</value>
                     <value>other</value>
                </list>
           </parameter>
        </constraint>

       <constraint name="acme:NonRealtyAssetsDocTypes" type="LIST" >
           <parameter name="allowedValues">
                <list>
                     <value>deed</value>
                     <value>last will</value>
                     <value>other notary file</value>
                </list>
           </parameter>
        </constraint>
   </constraints>
<types>
        <!– Documenti CM Salesiani –>
        <type name="acme:acmeCommon">
           <title> Modello base CM salesiani</title>
           <parent>cm:content</parent>
           <properties>
                <property name="acme:FilingDate">
                   <title>Data Inserimento Doc</title>
                   <type>d:date</type>
                   <mandatory>true</mandatory>
                   <index enabled="true">
                        <atomic>true</atomic>
                        <stored>false</stored>
                        <tokenised>false</tokenised>
                   </index>
                </property>
                <property name="acme:FilingOffice">
                   <title>Ufficio caricatore</title>
                   <type>d:text</type>
                   <mandatory>true</mandatory>
                   <default>Ufficio X</default>
                </property>
                <property name="acme:InnerRefNo">
                   <title>Protocollo ACS</title>
                   <type>d:text</type>
                   <mandatory>true</mandatory>
                   <index enabled="true">
                        <atomic>true</atomic>
                        <stored>false</stored>
                        <tokenised>false</tokenised>
                   </index>
                   <constraints>
                        <constraint ref="acme:InnerRefSys"/>
                   </constraints>
                </property>
                <property name="acmeSmiley SurpriseduterRefNo">
                   <title>Protocollo Esterno</title>
                   <type>d:text</type>
                   <mandatory>true</mandatory>
                   <default>Non Specif</default>
                   <index enabled="true">
                        <atomic>true</atomic>
                        <stored>false</stored>
                        <tokenised>false</tokenised>
                   </index>
                </property>
               <property name="acmeSmiley Very HappyocDate">
                   <title>Data Documento</title>
                   <type>d:date</type>
                   <mandatory>true</mandatory>
                   <index enabled="true">
                        <atomic>true</atomic>
                        <stored>false</stored>
                        <tokenised>false</tokenised>
                   </index>
                </property>
           </properties>
        </type>
        <type name="acme:Assets">
           <title>Modello Comune Assets ACME</title>
           <parent>acme:acmeCommon</parent>
           <properties>
                <property name="acme:XXX1">
                   <title>Campo Variabile 1</title>
                   <type>d:text</type>
                   <mandatory>false</mandatory>
                </property>
                <property name="acme:XXX2">
                   <title>Campo Variabile 2</title>
                   <type>d:text</type>
                   <mandatory>false</mandatory>
                </property>
                <property name="acme:acmeBranch">
                   <title>Branch</title>
                   <type>d:text</type>
                   <mandatory>true</mandatory>
                   <index enabled="true">
                        <atomic>true</atomic>
                        <stored>false</stored>
                        <tokenised>false</tokenised>
                   </index>
                   <constraints>
                        <constraint ref="acme:ACMEBranches" />
                   </constraints>
                </property>
                <property name="acme:LegalEntity">
                   <title>Ente Giuridico</title>
                   <type>d:text</type>
                   <mandatory>true</mandatory>
                </property>
                <property name="acme:CounterPart">
                   <title>Controparte</title>
                   <type>d:text</type>
                   <mandatory>true</mandatory>
                </property>
                <property name="acme:AssetValue">
                   <title>Valore</title>
                   <type>d:float</type>
                   <mandatory>false</mandatory>
                </property>
                <property name="acme:Currency">
                   <title>Valuta</title>
                   <type>d:text</type>
                   <mandatory>false</mandatory>
                   <constraints>
                        <constraint ref="acme:Currencies"/>
                   </constraints>
                </property>
           </properties>
        </type>
        <type name="acme:AcqDocs">
           <title>Acquisizione Immobili</title>
           <parent>acme:Assets</parent>
           <overrides>
                <property name="acme:XXX1">
                   <title>Modalit&#224; acquisizione immobile</title>
                   <mandatory>true</mandatory>
                   <constraints>
                        <constraint ref="acme:AcqWays" />
                   </constraints>
                </property>
                <property name="acme:XXX2">
                   <title>Tipologia documento immobiliare</title>
                   <mandatory>true</mandatory>
                   <index enabled="true">
                        <atomic>true</atomic>
                        <stored>false</stored>
                        <tokenised>false</tokenised>
                   </index>
                   <constraints>
                        <constraint ref="acme:AcqDocTypes" />
                   </constraints>
                </property>
           </overrides>
        </type>

        <type name="acmeSmiley Very HappyisDocs">
           <title> Cessione Immobili</title>
           <parent>acme:Assets</parent>
           <overrides>
                 <property name="acme:XXX1">
                   <title>Modalit&#224; cessione immobile</title>
                   <type>d:text</type>
                   <mandatory>true</mandatory>
                   <constraints>
                        <constraint ref="acmeSmiley Very HappyisWays" />
                   </constraints>
                </property>
                <property name="acme:XXX2">
                   <title>Tipologia documento immobiliare</title>
                   <type>d:text</type>
                   <mandatory>true</mandatory>
                   <index enabled="true">
                        <atomic>true</atomic>
                        <stored>false</stored>
                        <tokenised>false</tokenised>
                   </index>
                   <constraints>
                        <constraint ref="acmeSmiley Very HappyisDocTypes" />
                   </constraints>
                </property>
           </overrides>
        </type>

        <type name="acme:WrkDocs">
           <title>Lavori su Immobili</title>
           <parent>acme:Assets</parent>
           <overrides>
                <property name="acme:XXX2">
                   <title>Tipologia Documento lavori</title>
                   <type>d:text</type>
                   <mandatory>true</mandatory>
                   <index enabled="true">
                        <atomic>true</atomic>
                        <stored>false</stored>
                        <tokenised>false</tokenised>
                   </index>
                   <constraints>
                        <constraint ref="acme:WrkDocTypes" />
                   </constraints>
                </property>
           </overrides>
        </type>
   </types>
</model>

sbixsbix
Champ in-the-making
Champ in-the-making
I tried also to throw away all the constraints overrides.
No, overrides for constraints, only for the title of the properties of my own model, properties not inherited by the cm:content.
NO WAY, same error

mitpatoliya
Star Collaborator
Star Collaborator
Please post your modified content model.
also you need to validate the model xml file from eclipse or whatever IDE you are using.
If there are any problem with tags you will come to know.

sbixsbix
Champ in-the-making
Champ in-the-making
Mits,
I have already posted the whole xml file by cut&paste in the post of 04/04/2013 - 08:14.

Probably it is possible to change only some values nothing more

mitpatoliya
Star Collaborator
Star Collaborator
still getting the same error even after removing the constrains?
And which kind of limitation you meant here?

sbixsbix
Champ in-the-making
Champ in-the-making
Mits,
forgive me for the delay in aswering.
Yes, still getting same error, even after removing constraints.
After some thoughts about I have to conclude that some changes on cm:whatever are obviously forbidden.
Try to imagine what should happen if I could change the type of cm:description in, lets say,  d:float.

ipirat
Champ in-the-making
Champ in-the-making
Absolutely. According to modelSchema.xsd:

   <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>

the override only will allow overriding "mandatory", "default" and "constraints".


As for the Business Case: It's still the same Property after all. Depending on a (specialized) type or aspect, the property may become mandatory or more/less restrictive with the constraints.

Example: foo:doc has a prop "fooSmiley TongueublishingDate". an aspect fooSmiley Tongueublished will make the "fooSmiley TongueublishingDate" mandatory and may add a constraint, that the publishingDate must be in the past.