Content model

1 Default Content Model

<configRoot>

<TOMCAT_HOME>/webapps/alfresco/WEB-INF/classes

<JBOSS_HOME>/server/default/tmp/deploy/tmp*alfresco-exp.war/WEB-INF/classes

A Content Model is a collection of related content types and aspects.

<configRoot>/alfresco/model (maintained by Alfresco)

Domain models:

  • contentModel.xml: This model describes the Content Domain Model, such as folder, file, person, category, and dublin core
  • systemModel.xml: This model describes system-level Repository concepts
  • applicationModel.xml: This model describes the Alfresco Application Model
  • dictionaryModel.xml: This model describes the Dictionary Meta-model

2 Custom Content Model

"extension" location

<TOMCAT_HOME>/shared/classes/alfresco/extension

<JBOSS_HOME>/server/default/conf/alfresco/extension

Steps to define a custom model in the extension folder are as follows:

1. Create a custom model Spring context file.

2. Create a custom model definition file.

3. Create a custom web client configuration file.

<your-custom-modelname>-context.xml [1..*)

<your-custom-modelname>Model.xml [1..*)

web-client-config-custom.xml [1]

2.1 Custom Aspect

  1. Define the custom properties and types of properties.
  2. Extend the Alfresco Content Model with the custom aspect.
  3. Configure the Web Client application for the custom aspect.
  4. Restart Alfresco to make sure that the new changes are effective.

The list of property types -> <configRoot>/Alfresco/model/dictionaryModel.xml

text, content (binary), int, long, float, date (y-m-d), datetime, Boolean, category, path (URL)

Example:

Property_name Property_label Property_type Mandatory Default_value

CustomerName Customer Name text No None

NewCustomer New Customer Boolean No True

Elements of a property:

Property name, Title (label), Type, Protected (is web client read only), Mandatory, Multiple, Default (value)

2.2 Constraints

  • REGEX: ensures that a property value matches a defined regular expression pattern
  • LIST: ensures that a property value is picked up from a list of predefined values
  • MINMAX: ensures that the given property value falls within a defined numeric range
  • LENGTH: ensures that the given property value falls within a defined character length range
  • Custom constraints can be defined by using Java Programming Language

2.3 Display labels

By default, the property labels are taken from the <title> value of the property element, as given in the content model file. Alternatively, it is possible to override this by using the display-label attribute in the web-client-config-custom.xml file.

However, the property labels displayed are not internationalized. In order to achieve internationalized display labels, use the displaylabel-

id attribute in the web-client-config-custom.xml file, as follows.

<property-sheet>

------------

<show-property name="size" display-label-id="size" />

Label Ids and labels used in Alfresco Explorer are defined in the <config>/messages/webclient.properties file. To support a specific language, you need to have a language-specific properties file. For example, the properties file for German language labels is webclient_de_DE.properties.

You can add your custom label Ids and label text for specific languages in the webclient.properties file, which is in the <extension>/messages folder.

2.4 Custom associations

2.4.1 Reference association

2.4.2 Child association

If you delete the parent, then all of their children are deleted too.

2.5 Presentation Template for custom content types

The space Company Home > Data Dictionary > Presentation Templates contains presentation templates.

2.6 Dynamic models

Do not require restart.

Are XML based model files that are uploaded to Alfresco's repository in the Company Home/Data Dictionary/Model space.

In a multi-tenant setup, the models defined in the <extension> folder are available to all tenants. If you would like to customize content types and custom aspects for a specific tenant only, then a dynamic model is the best choice.

2.7 Dynamic web client configuration

Company Home > Data Dictionary > Web Client Extension space. Upload the web-client-config-custom.xml file.

If the web-client-config-custom.xml file has been added, edited, or updated, it can be dynamically reloaded by using the web client configuration console via:

http://<server>:<port>/alfresco/faces/jsp/admin/webclientconfigconsole.jsp

This has a single command, reload, which will cause the web client configuration to be re-loaded.