Data models and forms


This document introduces the setting and the administration of data models and forms for the beCPG software. It is intended to beCPG administrators. A video presents the creation of models and forms.

Data models (manually)

It’s possible to enrich the beCPG model by adding :
  • Properties: text values, integers, data lists etc...
  • Associations: association to an object type ;
  • Objects types: a compound of several properties/associations ;
  • Aspects: group of properties and/or associations which can be added to a type of object. This allows the re utilisation of a group of properties, common to many object types, for example a group of properties « Saleable products ».

This necessitates knowledge of XML and knowledge of content modelisation.


The modification of the data model necessitates the modification of 3 files :

  1. <installLocation>/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/module/becpg-{$client}-core/model/{$client}Model.xml to modify the data model (addition of properties, associations) ;
  2. <installLocation>/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/module/becpg-{$client}-core/model/{$client} to define the properties wordings ;
  3. <installLocation>/tomcat/webapps/share/WEB-INF/classes/alfresco/{$client}-form-config.xml to define the formatting of edition and consultation forms.

Where {$client}, is the name of the client.

The modified files Model.xml et can be copied and pasted in the repertory <installLocation>/tomcat/shared/classes/alfresco/extension/ to facilitate the identification of the modified files. The naming convention is the following :
  • ext-{$client}Model.xml
  • ext-{$client}

The modified file -form-config.xml can be copied and pasted in the repertory <installLocation>/tomcat/shared/classes/alfresco/web-extension to facilitate it’s identification. The naming convention is the following :

In order to take into account the modifications, the application must be restarted by typing : sudo service alfresco restart

Setting of a property

Properties types are :

  • d:date
  • d:text
  • d:content
  • d:int
  • d:long
  • d:any
  • d:float
  • d:datetime
  • d:double
  • d:boolean
  • d:category
  • d:noderef
  • d:path

A property is defined by :

  <property name="...">
    <type>Type de données</type>
    <mandatory>obligatoire ou non</mandatory>
    <multiple>Valeur multiple ou non</multiple>
    <default>Valeur par défaut</default>
       <constraint ref="ID" />

Example :

<property name="bcpg:productType">
    <constraint ref="bcpg:systemProductType" />

Setting of a constraint

Constraints are defined in the section <contraints/> of the file {$client}Model.xml.

Here are some examples of constraints :

  • Regular expression :
<constraint name="test:regex1" type="REGEX">
       <parameter name="expression"><value>[A-Z]*</value></parameter>
       <parameter name="requiresMatch"><value>false</value></parameter>

  • Length Min/Max
<constraint name="test:stringLength1" type="LENGTH">
        <parameter name="minLength"><value>0</value></parameter>
        <parameter name="maxLength"><value>256</value></parameter>

  • Number Min/Max
<constraint name="test:minMax1" type="MINMAX">
        <parameter name="minValue"><value>0</value></parameter>
        <parameter name="maxValue"><value>256</value></parameter>

  • Data lists
<constraint name="test:list1" type="LIST">
        <parameter name="allowedValues">
        <parameter name="caseSensitive"><value>true</value></parameter>

More details :


An aspect is a group of properties or associations which can be applied to a type. An aspect can be mandatory or not.

     <aspect name="cm:auditable">
            <property name="cm:created">
            <property name="cm:creator">
            <property name="cm:modified">
            <property name="cm:modifier">
            <property name="cm:accessed">

The addition of a mandatory aspect to a type is done in the section : <mandatory-aspects/>.

Example :

<type name="XXX">

Where ZZZ is the mandatory aspect defined on the type XXX.


The logs file is situated in the following repertory of the server: /var/log/alfresco/alfresco.log

Consultation, edition, creation and search forms

Forms are defined in the file :


« Forms » refer to:
  • Creation form ;
  • Edition form ;
  • Consultation form ;
  • Search form ;
  • Bulk edition form

A form is defined by :

The form type :

  • Creation
<config evaluator="model-type" condition="bcpg:finishedProduct">
    <form id="create">

  • Edition
<config evaluator="node-type" condition="bcpg:finishedProduct">

* Recherche
<config evaluator="model-type" condition="bcpg:product">
      <form id="search"/>

  • Bulk edition
<config evaluator="model-type" condition="bcpg:product">
     <form id="bulk-edit"/>

  • Object type 
<config evaluator="node-type" condition="bcpg:finishedProduct">

  • Fields displayed in the section <field-visibility/>
<show id="bcpg:legalName" />

  • The formatting in the section <appearance/>
<field id="bcpg:meatCharacts" set="charact">
    <control template="/fr/becpg/components/form/controls/textarea.ftl" >
        <control-param name="rows">4</control-param>

Where :

« set » defines the « fields » gathering ;
« template » defines the « Freemarker » template used to display the field. If nothing has been defined, the system takes the template by default ;
« control-param » defines a parameter of the « Freemarker » template.

More details :

Data models (designer)

The beCPG models designer allows the creation of data models and forms. It’s accessible from the upper band with the administrator role.

The designer is composed of 3 panels :

  • The left panel displays a tree representative of the model and a tree representative of the forms ;
  • The central panel displays the edition forms for forms and models ;
  • The right panel displays a pallette for grouping and control.

The choice of the file to display the model and the form is done thanks to the drop down menu in the tool bar of the left panel.

The models tree allows the creation of types, aspects, properties and constraints by positionning on the tree and pressing the button « New child ». The choice of the element type to be created is asked and eventually, the choice of the model type too.

Once the model has been created or modified, at the model root, press « Publish ».

Notes :

  • Every mandatory field has to be filled,
  • A type can be deleted if neither of the elements in the repository or in the bin has it ;
  • A property can only be modified by overloading the type or the aspect.

The creation of a form is done by dragging and dropping a type to the forms tree or thanks to the « New child » button. The association between controls and fields or fields grouping is done by drag and drop from the pallet to the area corresponding in the central panel.

In order to publish a form, hover over the forms tree root and press « Publish ».

The overview is done by selecting, in the models tree, a type and by pressin « Overview ». The type should be published. The form with the « Create » identifier associated to the type should be published.

For more information: