cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Content Model Tutorial

jpotts
World-Class Innovator
World-Class Innovator
If you are new to creating custom content models and configuring the Explorer and Share user interfaces to show the types, aspects, properties, and associations from your custom content model, please read the <a href="http://ecmarchitect.com/alfresco-developer-series-tutorials/content/tutorial/tutorial.html">Custom Content Model tutorial</a> available at ecmarchitect.com. The tutorial includes how to create a custom model, how to configure Alfresco Share, and how to work with the CMIS API to perform CRUD functions against the repository using your custom content model, including several CMIS Query Language examples.

The tutorial was recently (January, 2014) updated to assume you are using the Alfresco Maven SDK and AMPs rather than the old Ant-based SDK to produce ZIPs.

Jeff
29 REPLIES 29

vishal3521
Champ in-the-making
Champ in-the-making
Hey Jeff,

We are using alfresco 4.0.2, does this tutorial apply for this version too? If not, kindly share any other reference on using custom content model with alfresco 4.0.2. Thanks.

Vishal

jpotts
World-Class Innovator
World-Class Innovator
Yes, the second edition should work fine with 4.0.

Jeff

darkstar1
Confirmed Champ
Confirmed Champ
As I read in one of your older posts (http://ecmarchitect.com/archives/2012/02/27/1555) extending a person is slightly different. I am currently trying to extend a person and I haven't managed to succeed yet. I am currently following this post: http://forums.alfresco.com/forum/developer-discussions/content-modeling/add-properties-user-model-08... however I keep getting the error that cm:authority isn't found.
This is the extended contentModel:

<?xml version="1.0" encoding="UTF-8"?>

<!– Custom 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="cm:contentModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <!– Optional meta-data about the model –>
   <description>Professional Person Model</description>
   <author></author>
   <version>1.0</version>

   <!– Imports are required to allow references to definitions in other models –>
   <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" />
               
                <import uri="http://www.syn.fr/model/person/ext" prefix="ppm"/>
   </imports>

<types>
      <type name="cm:person">
         <title>Person</title>
         <parent>cm:authority</parent>
         <properties>
            <!– The tokenisation set here is ignored - it is fixed for this type –>
            <!– This is so you can not break person lookup –>
            <property name="cm:userName">
               <type>d:text</type>
               <mandatory>true</mandatory>
               <constraints>
                  <constraint ref="cm:userNameConstraint" />
               </constraints>
            </property>
            <property name="cm:homeFolder">
               <type>d:noderef</type>
               <mandatory>true</mandatory>
            </property>
            <property name="cm:firstName">
               <type>d:text</type>
               <mandatory>true</mandatory>
            </property>
            <property name="cm:lastName">
               <type>d:text</type>
               <mandatory>true</mandatory>
            </property>
            <property name="cm:middleName">
               <type>d:text</type>
            </property>
            <property name="cm:email">
               <type>d:text</type>
            </property>
            <property name="cm:organizationId">
               <type>d:text</type>
            </property>
            <property name="cm:homeFolderProvider">
               <type>d:text</type>
            </property>
            <property name="cm:defaultHomeFolderPath">
               <type>d:text</type>
            </property>
            <property name="cm:presenceProvider">
               <type>d:text</type>
            </property>
            <property name="cm:presenceUsername">
               <type>d:text</type>
            </property>
            <property name="cm:organization">
               <type>d:text</type>
            </property>
            <property name="cm:jobtitle">
               <type>d:text</type>
            </property>
            <property name="cm:location">
               <type>d:text</type>
            </property>
            <property name="cm:persondescription">
               <type>d:content</type>
            </property>
            <property name="cm:telephone">
               <type>d:text</type>
            </property>
            <property name="cm:mobile">
               <type>d:text</type>
            </property>
            <property name="cm:companyaddress1">
               <type>d:text</type>
            </property>
            <property name="cm:companyaddress2">
               <type>d:text</type>
            </property>
            <property name="cm:companyaddress3">
               <type>d:text</type>
            </property>
            <property name="cm:companypostcode">
               <type>d:text</type>
            </property>
            <property name="cm:companytelephone">
               <type>d:text</type>
            </property>
            <property name="cm:companyfax">
               <type>d:text</type>
            </property>
            <property name="cm:companyemail">
               <type>d:text</type>
            </property>
            <property name="cm:skype">
               <type>d:text</type>
            </property>
            <property name="cm:instantmsg">
               <type>d:text</type>
            </property>
            <property name="cm:userStatus">
               <type>d:text</type>
            </property>
            <property name="cm:userStatusTime">
               <type>d:datetime</type>
            </property>
            <property name="cm:googleusername">
               <type>d:text</type>
            </property>
           
            <property name="cm:emailFeedDisabled">
                <type>d:boolean</type>
            </property>
           
            <property name="cm:subscriptionsPrivate">
                <type>d:boolean</type>
            </property>
           
            <!– system maintained / protected values –>
           
            <property name="cm:emailFeedId">
                <type>d:long</type>
                <protected>true</protected>
            </property>
           
            <property name="cm:sizeCurrent">
                <type>d:long</type>
                <protected>true</protected>
                <mandatory enforced="true">true</mandatory>
            </property>
           
            <property name="cm:sizeQuota">
                <type>d:long</type>
                <protected>true</protected>
            </property>
           
         </properties>
        
         <associations>
            <association name="cm:avatar">
               <source>
                  <role>cm:avatarOf</role>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>cm:content</class>
                  <role>cm:hasAvatar</role>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </target>
            </association>
         </associations>
      </type>

      <mandatory-aspects>
    <aspect>ppm:attributes</aspect>
      </mandatory-aspects>
</types>    
</model>

iprosonic
Champ in-the-making
Champ in-the-making
Hi,  can any one help me create a custom form in alfresco and map the data to content model in alfresco.

Thanks in advance.
Saurabh

mitpatoliya
Star Collaborator
Star Collaborator
you mean to say you want to add custom properties to alfresco content?

rafaelscg
Champ on-the-rise
Champ on-the-rise
If you're looking for how you can create new properties into custom types or aspects, you'll need to se the jpotts link's (The firts comment of this topic). trying too this page below:

http://wiki.alfresco.com/wiki/Dynamic_Models

You can deploy your models dynamically, without stop server need's.

vassilisx
Champ in-the-making
Champ in-the-making
When using Greek characters in .properties files they are not rendered correctly in Share. I found that in other .properties files, Japanese for example, the character UTF codes are used instead (eg \u3039).

Is this the only way to display non-latin characters in Share?

dharinipradeep
Champ in-the-making
Champ in-the-making
I am new to Alfresco. we are using Alfresco 4.2. We are creating a system in which we need to implement dynamic dropdown in content model. I am going through its documentation and tried to create content model as given in doc. I have already created contentModel xml file in /tomcat/shared/classes/alfresco/extension. Even then its not working. Thanks.