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

mvicidomini
Champ in-the-making
Champ in-the-making
Sorry, but have you had the time to look at the customModel.txt ?

Thanks a lot

jpotts
World-Class Innovator
World-Class Innovator
Your model xml looks fine, although you might want to change the "someco" and "Jeff Potts" references at the top. Smiley Happy

I noticed your posted your model context file earlier and that your bean ID is "custommodel.dictionaryBootstrap". If you have deployed any other custom content models that also use that bean ID, they may be overriding this particular content model.

So make sure you use a unique bean ID in your context file.

Jeff

droberts1
Champ in-the-making
Champ in-the-making
I've been working through your content model tutorial and have been unable to get it to work correctly. I can successfully create the repository and share amps and launch them, created the scModel.xml, modified service-context.xml, and created share-config-custom.xml as per the tutorial document. I don't seem to get any errors in maven and I can log into the demo Share, but when I go to Rules configuration for a folder in the Document library in the demo site and look for the new custom type and aspects, they are not there. I'm probably missing something obvious, but I don't know where to start looking for the problem. Can you point me in the right direction?

droberts1
Champ in-the-making
Champ in-the-making
Figured it out. Had misplaced the closing </config> tag in share-config-custom.xml. As I thought, something simple. Looking at the sample gave me the clue.

hello_wrold
Champ in-the-making
Champ in-the-making
Bonjour,
I've been fiddling for some time with Alfresco 4.2 but now that Jeff has updated his tutorials (thank you! Please write a new book on alfresco 5.0 – I'll buy one!) I took my my courage and tried to port an existing project to the new kid on the block (I'm also keen on having faceted search).

Problem is, my model's properties don't show up in Alfresco 5.0 when build/deployed as suggested. Boiled down to a trivial custom model I have in arc-repo3/src/main/amp/config/alfresco/module/arc-repo3/model/arcModel.xml:

<?xml version="1.0" encoding="UTF-8"?>
<model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"              
       xsi:schemaLocation="http://www.alfresco.org/model/dictionary/1.0 /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/model/modelSchema.xsd"  
       xmlns="http://www.alfresco.org/model/dictionary/1.0" name="arc:arcmodel">
    <author>hello wrold</author>
    <version>0.0</version>
   <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" />
    </imports>
   <namespaces>
        <namespace uri="http://www.foobar.org/model/content/1.0" prefix="arc" />
    </namespaces>

   <aspects>
        <aspect name="arc:hasindex">
            <title>indexable</title>
            <properties>
                <property name="arc:index">
                <type>d:text</type>
                </property>
            </properties>
        </aspect>
    </aspects>
</model>


and the service-context.xml in arc-repo3/context/service-context.xml:

?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
    <bean id="arc-repo3_dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/module/arc-repo3/model/arcModel.xml</value>
            </list>
        </property>
    </bean>
</beans>


The point is, the same model work fine when maven-built using the old sdk. Even in Alfresco 5.0c to d. Actually my (skd2 based) share-config-custom works with an old repo amp I built using skd1.1.1-1. Building, deploying, and running don't produce errors in the logs.

I don't know now if this is due a change in the suggested dev enviroment or a subtle change in the sdk. Maven is up to date with 3.3.3, I still stick to Eclipse Kepler, though. As trivial as this is going to be, I just fail to spot my mistake.

Anyone here with similar issues when switching to Alfresco 5.0?

thk
Champ on-the-rise
Champ on-the-rise
Hi,

I`ve added my custom properties in the advanced search form as described in the tutorial. The custom properties are now displayed correctly, but if I search my repository using this custom fields the advanced search doesn`t find any results even in cases in which there should be results. Using the non-custom-fields the search still works and I get correct results.
I`m using Alfresco 5.0d. Attached the share-config-custom.xml.

Thanks in advance for help!

hello_wrold
Champ in-the-making
Champ in-the-making
It looks like, you picked the wrong file to attach.

thk
Champ on-the-rise
Champ on-the-rise
I uploaded the file again. Now its ok. But it was no mistake in picking the wrong file, the upload process seems to transform my .log-File for some reason.

kino-nnov
Champ in-the-making
Champ in-the-making
Hello!
I'm trying to complete the tutorial. I've created content-tutorial-repo.amp and content-tutorial-share.amp just as it's written in the tutorial. It works fine in Maven's test Share. But when I'm trying to install it into the clean and new installation of Alfresco Community 5.0.d I get nothing. Just nothing. Even in logs I can't find any errors showing me where I'm worng.

AMPs are being installed as described in documentation: with alfrseco-mmt.jar. REPO amp I install into the alfresco.war, SHARE amp I install into the share.war. There's just 1 warning I got during install process:
- WARNING: The file '/WEB-INF/lib/slf4j-api-1.7.7.jar' is being overwritten by this module. The original has been backed-up to '/WEB-INF/classes/alfresco/module/backup/78b128de-65cf-11e5-97fc-b327687a319.bin'

The same warning for both WARs.

Help me please, tell me where I'm wrong.

janaka1984
Star Contributor
Star Contributor
Hi jpotts,

i need to retrieve List of content model data into  aikau "alfresco/renderers/PublishingDropDownMenu".
please can you give some example or solution to do it?



<aspects>

        <!– Example Custom Site Properties Aspect –>
      <aspect name="stcp:customProperties">
        <title>Custom Person Properties</title>         
         <properties>
            <property name="stcp:Person">
               <title>Status</title>
               <type>d:text</type>
       <constraints>
                 <constraint name="stcp:projectphase" type="LIST">
                   <parameter name="allowedValues">
                      <list>
                         <value>Prepare</value>
                         <value>Open</value>
                         <value>Closed</value>
                      </list>
                   </parameter>
                   <parameter name="caseSensitive"><value>true</value></parameter>
                 </constraint>
               </constraints>
            </property>
         </properties>
      </aspect>

   </aspects>


Regards
Janaka