<binding>

   <namespace uri="http://www.alfresco.org/model/dictionary/1.0" default="elements"/>
   
   <format type="java.util.Date" serializer="org.alfresco.repo.dictionary.M2XML.serialiseDate" deserializer="org.alfresco.repo.dictionary.M2XML.deserialiseDate"/>
         
   <mapping name="model" class="org.alfresco.repo.dictionary.M2Model">
      <value style="attribute" name="name" field="name"/>
      <value name="description" field="description" usage="optional"/>
      <value name="author" field="author" usage="optional"/>
      <value name="published" field="published" usage="optional"/>
      <value name="version" field="version" usage="optional"/>
      
      <structure name="imports" usage="optional">
         <collection field="imports" factory="org.alfresco.repo.dictionary.M2Model.createList">
            <structure name="import" type="org.alfresco.repo.dictionary.M2Namespace" usage="optional">
               <value style="attribute" name="uri" field="uri"/>
               <value style="attribute" name="prefix" field="prefix"/>
            </structure>
         </collection>
      </structure>

      <structure name="namespaces" usage="optional">
         <collection field="namespaces" factory="org.alfresco.repo.dictionary.M2Model.createList">
            <structure name="namespace" type="org.alfresco.repo.dictionary.M2Namespace" usage="optional">
               <value style="attribute" name="uri" field="uri"/>
               <value style="attribute" name="prefix" field="prefix"/>
            </structure>
         </collection>
      </structure>
      
      <structure name="data-types" usage="optional">
         <collection field="dataTypes" factory="org.alfresco.repo.dictionary.M2Model.createList">
            <structure name="data-type" type="org.alfresco.repo.dictionary.M2DataType" usage="optional">
               <value style="attribute" name="name" field="name"/>
               <value name="title" field="title" usage="optional"/>
               <value name="description" field="description" usage="optional"/>
               <value name="analyser-class" field="analyserClassName"/>
               <value name="java-class" field="javaClassName"/>
            </structure>
         </collection>
      </structure>

      <structure name="types" usage="optional">
         <collection field="types" item-type="org.alfresco.repo.dictionary.M2Type" factory="org.alfresco.repo.dictionary.M2Model.createList"/>
      </structure>
      
      <structure name="aspects" usage="optional">
         <collection field="aspects" item-type="org.alfresco.repo.dictionary.M2Aspect" factory="org.alfresco.repo.dictionary.M2Model.createList"/>
      </structure>
   </mapping>


   <mapping class="org.alfresco.repo.dictionary.M2Class" abstract="true">
      <value style="attribute" name="name" field="name"/>
      <value name="title" field="title" usage="optional"/>
      <value name="description" field="description" usage="optional"/>
      <value name="parent" field="parentName" usage="optional"/>
      
      <structure name="properties" usage="optional">
         <collection field="properties" item-type="org.alfresco.repo.dictionary.M2Property" factory="org.alfresco.repo.dictionary.M2Model.createList"/>
      </structure>
      <structure name="associations" usage="optional">
         <collection field="associations" factory="org.alfresco.repo.dictionary.M2Model.createList"/>
      </structure>
      <structure name="overrides" usage="optional">
         <collection field="propertyOverrides" item-type="org.alfresco.repo.dictionary.M2PropertyOverride" factory="org.alfresco.repo.dictionary.M2Model.createList">
            <structure name="property" type="org.alfresco.repo.dictionary.M2PropertyOverride" usage="optional">
               <value style="attribute" name="name" field="name"/>
               <value name="mandatory" field="isMandatory" usage="optional"/>
               <value name="default" field="defaultValue" usage="optional"/>
            </structure>
         </collection>
      </structure>
      <structure name="mandatory-aspects" usage="optional">
         <collection field="mandatoryAspects" factory="org.alfresco.repo.dictionary.M2Model.createList">
            <value name="aspect"/>
         </collection>
      </structure>
   </mapping>

   <mapping name="type" class="org.alfresco.repo.dictionary.M2Type" extends="org.alfresco.repo.dictionary.M2Class">
      <structure map-as="org.alfresco.repo.dictionary.M2Class"/>      
   </mapping>
      
   <mapping name="aspect" class="org.alfresco.repo.dictionary.M2Aspect"  extends="org.alfresco.repo.dictionary.M2Class">
      <structure map-as="org.alfresco.repo.dictionary.M2Class"/>
   </mapping>

   <mapping name="property" class="org.alfresco.repo.dictionary.M2Property">
      <value style="attribute" name="name" field="name"/>
      <value name="title" field="title" usage="optional"/>
      <value name="description" field="description" usage="optional"/>
      <value name="type" field="propertyType"/>
      <value name="protected" field="isProtected" usage="optional"/>
      <value name="mandatory" field="isMandatory" usage="optional"/>
      <value name="multiple" field="isMultiValued" usage="optional"/>
      <value name="default" field="defaultValue" usage="optional"/>
      <structure name="index" usage="optional">
         <value style="attribute" name="enabled" field="isIndexed"/>
         <value name="atomic" field="isIndexedAtomically" usage="optional"/>
         <value name="stored" field="isStoredInIndex" usage="optional"/>
         <value name="tokenised" field="isTokenisedInIndex" usage="optional"/>
      </structure>
   </mapping>

   <mapping class="org.alfresco.repo.dictionary.M2ClassAssociation" abstract="true">
      <value style="attribute" name="name" field="name"/>
      <value name="title" field="title" usage="optional"/>
      <value name="description" field="description" usage="optional"/>
      <structure name="source" usage="optional">
         <value name="role" field="sourceRoleName" usage="optional"/>
         <value name="mandatory" field="isSourceMandatory" usage="optional"/>
         <value name="many" field="isSourceMany" usage="optional"/>
      </structure>         
      <structure name="target">
         <value name="class" field="targetClassName"/>
         <value name="role" field="targetRoleName" usage="optional"/>
         <value name="mandatory" field="isTargetMandatory" usage="optional"/>
         <value name="many" field="isTargetMany" usage="optional"/>
      </structure>         
   </mapping>

   <mapping name="association" class="org.alfresco.repo.dictionary.M2Association" extends="org.alfresco.repo.dictionary.M2ClassAssociation">
      <structure map-as="org.alfresco.repo.dictionary.M2ClassAssociation"/>
   </mapping>
   
   <mapping name="child-association" class="org.alfresco.repo.dictionary.M2ChildAssociation" extends="org.alfresco.repo.dictionary.M2ClassAssociation">
      <structure map-as="org.alfresco.repo.dictionary.M2ClassAssociation"/>
      <value name="child-name" field="requiredChildName" usage="optional"/>
      <value name="duplicate" field="allowDuplicateChildName" usage="optional"/>
   </mapping>

</binding>