You are here

Creating a content model

You can create new content model using the Alfresco SDK.
Use the Alfresco SDK to build and deploy a new content model. In this tutorial you will see how to implement a bootstrap deployment.
  1. Create a new All-In-One SDK Project.

    The new project already contains a sample model that you can change to suit your needs.

  2. In your IDE, examine the file aio/aio-platform-jar/src/main/resources/alfresco/module/aio-platform-jar/context/bootstrap-context.xml.

    This is the Spring Bean configuration file for your new content model:

    <bean id="aio52-platform-jar.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
      <property name="models">
      <property name="labels">
           <!-- Bootstrap Resource Bundles for the content model types, aspects, properties etc -->
    This Spring bean links to your model file. It causes the model to extend the existing model, rather than replace it. The bean definition indicates that this model is to use a bootstrap deployment, which will require a server restart in order to take effect.
  3. In your IDE, open the file aio/aio-platform-jar/src/main/resources/alfresco/module/aio-platform-jar/model/content-model.xml.

    This is your new custom model. Replace the contents with the following text:

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Definition of new Model -->
    <!-- The important part here is the name - Note: the use of the my: namespace
         which is defined further on in the document -->
    <model name="my:contentModel" xmlns="">
       <!-- Optional meta-data about the model -->   
       <description>Example Custom Model</description>
       <author>Alfresco Documentation Team</author>
       <!-- Imports are required to allow references to definitions in other models -->   
          <!-- Import Alfresco Dictionary Definitions -->
          <import uri="" prefix="d"/>
          <!-- Import Alfresco Content Domain Model Definitions -->
          <import uri="" prefix="cm"/>
       <!-- Introduction of new namespaces defined by this model -->
       <!-- NOTE: The following namespace should be changed to reflect your own namespace -->
          <namespace uri="" prefix="my"/>
        <!--  Enterprise-wide generic document type -->
            <type name="my:doc">
                <title>MyCompany Generic Document</title>
            <type name="my:marketingDoc">
                <title>MyCompany Marketing Document</title>
            <type name="my:whitepaper">
                <title>MyCompany Whitepaper</title>

    This is the custom model that will extend the existing core model framework. The model adds three new types of document, a generic company document, a marketing document, and a whitepaper.

  4. To build and run the project see working with an AIO project.
  5. Check for any errors in the log file.
  6. Log into Share as admin. Check that login works as expected.
You have seen how to create a Maven archetype for your content model and deploy it in bootstrap mode.

Sending feedback to the Alfresco documentation team

You don't appear to have JavaScript enabled in your browser. With JavaScript enabled, you can provide feedback to us using our simple form. Here are some instructions on how to enable JavaScript in your web browser.